36283ae0 by Jason Lee

Fix a wrong logical for AddFuncMap method.

1 parent 53f917c9
...@@ -3,9 +3,8 @@ package beego ...@@ -3,9 +3,8 @@ package beego
3 //@todo add template funcs 3 //@todo add template funcs
4 4
5 import ( 5 import (
6 //"fmt"
7 "errors"
8 "fmt" 6 "fmt"
7 "errors"
9 "github.com/russross/blackfriday" 8 "github.com/russross/blackfriday"
10 "html/template" 9 "html/template"
11 "strings" 10 "strings"
...@@ -88,8 +87,8 @@ func Compare(a, b interface{}) (equal bool) { ...@@ -88,8 +87,8 @@ func Compare(a, b interface{}) (equal bool) {
88 // AddFuncMap let user to register a func in the template 87 // AddFuncMap let user to register a func in the template
89 func AddFuncMap(key string, funname interface{}) error { 88 func AddFuncMap(key string, funname interface{}) error {
90 if _, ok := beegoTplFuncMap[key]; ok { 89 if _, ok := beegoTplFuncMap[key]; ok {
90 return errors.New("funcmap already has the key")
91 }
91 beegoTplFuncMap[key] = funname 92 beegoTplFuncMap[key] = funname
92 return nil 93 return nil
93 }
94 return errors.New("funcmap already has the key")
95 } 94 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!