##// END OF EJS Templates
templater: extract private function to evaluate generator to byte string
Yuya Nishihara -
r37296:671a01cd default
parent child Browse files
Show More
@@ -313,6 +313,12 b' def findsymbolicname(arg):'
313 313 else:
314 314 return None
315 315
316 def _unthunk(context, mapping, thing):
317 """Evaluate a lazy byte string into value"""
318 if not isinstance(thing, types.GeneratorType):
319 return thing
320 return stringify(context, mapping, thing)
321
316 322 def evalrawexp(context, mapping, arg):
317 323 """Evaluate given argument as a bare template object which may require
318 324 further processing (such as folding generator of strings)"""
@@ -330,9 +336,7 b' def _unwrapvalue(context, mapping, thing'
330 336 thing = unwrapvalue(context, mapping, thing)
331 337 # evalrawexp() may return string, generator of strings or arbitrary object
332 338 # such as date tuple, but filter does not want generator.
333 if isinstance(thing, types.GeneratorType):
334 thing = stringify(context, mapping, thing)
335 return thing
339 return _unthunk(context, mapping, thing)
336 340
337 341 def evalboolean(context, mapping, arg):
338 342 """Evaluate given argument as boolean, but also takes boolean literals"""
General Comments 0
You need to be logged in to leave comments. Login now