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