Show More
@@ -256,26 +256,26 def runtemplate(context, mapping, templa | |||
|
256 | 256 | yield func(context, mapping, data) |
|
257 | 257 | |
|
258 | 258 | def buildfilter(exp, context): |
|
259 |
|
|
|
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, ( |
|
|
263 | return (runfilter, (arg, filt)) | |
|
264 | 264 | if n in funcs: |
|
265 | 265 | f = funcs[n] |
|
266 |
return (f, [ |
|
|
266 | return (f, [arg]) | |
|
267 | 267 | raise error.ParseError(_("unknown function '%s'") % n) |
|
268 | 268 | |
|
269 | 269 | def runfilter(context, mapping, data): |
|
270 |
|
|
|
271 |
thing = evalfuncarg(context, mapping, |
|
|
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( |
|
|
276 |
dt = |
|
|
275 | if isinstance(arg[1], tuple): | |
|
276 | dt = arg[1][1] | |
|
277 | 277 | else: |
|
278 |
dt = |
|
|
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 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] |
|
|
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