equal
deleted
inserted
replaced
340 else: |
340 else: |
341 thing = func(context, mapping, data) |
341 thing = func(context, mapping, data) |
342 return stringify(thing) |
342 return stringify(thing) |
343 |
343 |
344 _unwrapfuncbytype = { |
344 _unwrapfuncbytype = { |
|
345 None: _unwrapvalue, |
345 bytes: stringify, |
346 bytes: stringify, |
346 int: unwrapinteger, |
347 int: unwrapinteger, |
347 } |
348 } |
348 |
349 |
349 def unwrapastype(thing, typ): |
350 def unwrapastype(thing, typ): |
398 for arg in template: |
399 for arg in template: |
399 yield evalrawexp(context, mapping, arg) |
400 yield evalrawexp(context, mapping, arg) |
400 |
401 |
401 def runfilter(context, mapping, data): |
402 def runfilter(context, mapping, data): |
402 arg, filt = data |
403 arg, filt = data |
403 thing = evalfuncarg(context, mapping, arg) |
404 thing = evalrawexp(context, mapping, arg) |
404 try: |
405 try: |
|
406 thing = unwrapastype(thing, getattr(filt, '_intype', None)) |
405 return filt(thing) |
407 return filt(thing) |
406 except (ValueError, AttributeError, TypeError): |
408 except (ValueError, AttributeError, TypeError): |
407 sym = findsymbolicname(arg) |
409 sym = findsymbolicname(arg) |
408 if sym: |
410 if sym: |
409 msg = (_("template filter '%s' is not compatible with keyword '%s'") |
411 msg = (_("template filter '%s' is not compatible with keyword '%s'") |