templater: use a global funcs table
authorMatt Mackall <mpm@selenic.com>
Sat, 23 Jul 2011 14:33:35 -0500
changeset 14925 ab545a15d807
parent 14924 545e00279670
child 14926 4e7e63fc685a
templater: use a global funcs table
mercurial/templater.py
--- a/mercurial/templater.py	Sat Jul 23 06:09:14 2011 +0200
+++ b/mercurial/templater.py	Sat Jul 23 14:33:35 2011 -0500
@@ -172,14 +172,14 @@
 def buildfunc(exp, context):
     n = getsymbol(exp[1])
     args = [compileexp(x, context) for x in getlist(exp[2])]
+    if n in funcs:
+        f = funcs[n]
+        return (f, args)
     if n in context._filters:
         if len(args) != 1:
             raise error.ParseError(_("filter %s expects one argument") % n)
         f = context._filters[n]
         return (runfilter, (args[0][0], args[0][1], f))
-    elif n in context._funcs:
-        f = context._funcs[n]
-        return (f, args)
 
 methods = {
     "string": lambda e, c: (runstring, e[1]),
@@ -191,6 +191,9 @@
     "func": buildfunc,
     }
 
+funcs = {
+}
+
 # template engine
 
 path = ['templates', '../templates']