##// END OF EJS Templates
templater: inline getfilter() to buildfilter()...
Yuya Nishihara -
r26104:0f1bc7fa default
parent child Browse files
Show More
@@ -205,12 +205,6 b' def getlist(x):'
205 return getlist(x[1]) + [x[2]]
205 return getlist(x[1]) + [x[2]]
206 return [x]
206 return [x]
207
207
208 def getfilter(exp, context):
209 f = getsymbol(exp)
210 if f not in context._filters:
211 raise error.ParseError(_("unknown function '%s'") % f)
212 return context._filters[f]
213
214 def gettemplate(exp, context):
208 def gettemplate(exp, context):
215 if exp[0] == 'template':
209 if exp[0] == 'template':
216 return [compileexp(e, context, methods) for e in exp[1]]
210 return [compileexp(e, context, methods) for e in exp[1]]
@@ -254,8 +248,11 b' def runtemplate(context, mapping, templa'
254
248
255 def buildfilter(exp, context):
249 def buildfilter(exp, context):
256 func, data = compileexp(exp[1], context, methods)
250 func, data = compileexp(exp[1], context, methods)
257 filt = getfilter(exp[2], context)
251 n = getsymbol(exp[2])
258 return (runfilter, (func, data, filt))
252 if n in context._filters:
253 filt = context._filters[n]
254 return (runfilter, (func, data, filt))
255 raise error.ParseError(_("unknown function '%s'") % n)
259
256
260 def runfilter(context, mapping, data):
257 def runfilter(context, mapping, data):
261 func, data, filt = data
258 func, data, filt = data
General Comments 0
You need to be logged in to leave comments. Login now