##// END OF EJS Templates
templater: move function table to the "context" object...
Yuya Nishihara -
r36930:543afbdc default
parent child Browse files
Show More
@@ -493,8 +493,8 b' def buildfilter(exp, context):'
493 filt = context._filters[n]
493 filt = context._filters[n]
494 arg = compileexp(exp[1], context, methods)
494 arg = compileexp(exp[1], context, methods)
495 return (runfilter, (arg, filt))
495 return (runfilter, (arg, filt))
496 if n in funcs:
496 if n in context._funcs:
497 f = funcs[n]
497 f = context._funcs[n]
498 args = _buildfuncargs(exp[1], context, methods, n, f._argspec)
498 args = _buildfuncargs(exp[1], context, methods, n, f._argspec)
499 return (f, args)
499 return (f, args)
500 raise error.ParseError(_("unknown function '%s'") % n)
500 raise error.ParseError(_("unknown function '%s'") % n)
@@ -595,8 +595,8 b' def runarithmetic(context, mapping, data'
595
595
596 def buildfunc(exp, context):
596 def buildfunc(exp, context):
597 n = getsymbol(exp[1])
597 n = getsymbol(exp[1])
598 if n in funcs:
598 if n in context._funcs:
599 f = funcs[n]
599 f = context._funcs[n]
600 args = _buildfuncargs(exp[2], context, exprmethods, n, f._argspec)
600 args = _buildfuncargs(exp[2], context, exprmethods, n, f._argspec)
601 return (f, args)
601 return (f, args)
602 if n in context._filters:
602 if n in context._filters:
@@ -1376,6 +1376,7 b' class engine(object):'
1376 if filters is None:
1376 if filters is None:
1377 filters = {}
1377 filters = {}
1378 self._filters = filters
1378 self._filters = filters
1379 self._funcs = funcs # make this a parameter if needed
1379 if defaults is None:
1380 if defaults is None:
1380 defaults = {}
1381 defaults = {}
1381 if resources is None:
1382 if resources is None:
General Comments 0
You need to be logged in to leave comments. Login now