changeset 14925:ab545a15d807

templater: use a global funcs table
author Matt Mackall <mpm@selenic.com>
date Sat, 23 Jul 2011 14:33:35 -0500
parents 545e00279670
children 4e7e63fc685a
files mercurial/templater.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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']