285 func, data = arg |
285 func, data = arg |
286 return func(context, mapping, data) |
286 return func(context, mapping, data) |
287 |
287 |
288 def evalfuncarg(context, mapping, arg): |
288 def evalfuncarg(context, mapping, arg): |
289 """Evaluate given argument as value type""" |
289 """Evaluate given argument as value type""" |
290 thing = evalrawexp(context, mapping, arg) |
290 return _unwrapvalue(evalrawexp(context, mapping, arg)) |
|
291 |
|
292 # TODO: unify this with unwrapvalue() once the bug of templatefunc.join() |
|
293 # is fixed. we can't do that right now because join() has to take a generator |
|
294 # of byte strings as it is, not a lazy byte string. |
|
295 def _unwrapvalue(thing): |
291 thing = unwrapvalue(thing) |
296 thing = unwrapvalue(thing) |
292 # evalrawexp() may return string, generator of strings or arbitrary object |
297 # evalrawexp() may return string, generator of strings or arbitrary object |
293 # such as date tuple, but filter does not want generator. |
298 # such as date tuple, but filter does not want generator. |
294 if isinstance(thing, types.GeneratorType): |
299 if isinstance(thing, types.GeneratorType): |
295 thing = stringify(thing) |
300 thing = stringify(thing) |