##// END OF EJS Templates
templater: drop unneeded destructuring of argument tuple at buildfilter...
Yuya Nishihara -
r26125:c990afab default
parent child Browse files
Show More
@@ -256,26 +256,26 b' def runtemplate(context, mapping, templa'
256 256 yield func(context, mapping, data)
257 257
258 258 def buildfilter(exp, context):
259 func, data = compileexp(exp[1], context, methods)
259 arg = compileexp(exp[1], context, methods)
260 260 n = getsymbol(exp[2])
261 261 if n in context._filters:
262 262 filt = context._filters[n]
263 return (runfilter, (func, data, filt))
263 return (runfilter, (arg, filt))
264 264 if n in funcs:
265 265 f = funcs[n]
266 return (f, [(func, data)])
266 return (f, [arg])
267 267 raise error.ParseError(_("unknown function '%s'") % n)
268 268
269 269 def runfilter(context, mapping, data):
270 func, data, filt = data
271 thing = evalfuncarg(context, mapping, (func, data))
270 arg, filt = data
271 thing = evalfuncarg(context, mapping, arg)
272 272 try:
273 273 return filt(thing)
274 274 except (ValueError, AttributeError, TypeError):
275 if isinstance(data, tuple):
276 dt = data[1]
275 if isinstance(arg[1], tuple):
276 dt = arg[1][1]
277 277 else:
278 dt = data
278 dt = arg[1]
279 279 raise util.Abort(_("template filter '%s' is not compatible with "
280 280 "keyword '%s'") % (filt.func_name, dt))
281 281
@@ -313,7 +313,7 b' def buildfunc(exp, context):'
313 313 if len(args) != 1:
314 314 raise error.ParseError(_("filter %s expects one argument") % n)
315 315 f = context._filters[n]
316 return (runfilter, (args[0][0], args[0][1], f))
316 return (runfilter, (args[0], f))
317 317 raise error.ParseError(_("unknown function '%s'") % n)
318 318
319 319 def date(context, mapping, args):
General Comments 0
You need to be logged in to leave comments. Login now