##// END OF EJS Templates
templater: pass (context, mapping) down to unwrapvalue()...
Yuya Nishihara -
r37295:9e8128e8 default
parent child Browse files
Show More
@@ -319,7 +319,7 b' def join(context, mapping, args):'
319 # TODO: perhaps this should be evalfuncarg(), but it can't because hgweb
319 # TODO: perhaps this should be evalfuncarg(), but it can't because hgweb
320 # abuses generator as a keyword that returns a list of dicts.
320 # abuses generator as a keyword that returns a list of dicts.
321 joinset = evalrawexp(context, mapping, args[0])
321 joinset = evalrawexp(context, mapping, args[0])
322 joinset = templateutil.unwrapvalue(joinset)
322 joinset = templateutil.unwrapvalue(context, mapping, joinset)
323 joinfmt = getattr(joinset, 'joinfmt', pycompat.identity)
323 joinfmt = getattr(joinset, 'joinfmt', pycompat.identity)
324 joiner = " "
324 joiner = " "
325 if len(args) > 1:
325 if len(args) > 1:
@@ -157,7 +157,7 b' def unwraphybrid(context, mapping, thing'
157 return thing
157 return thing
158 return thing.show(context, mapping)
158 return thing.show(context, mapping)
159
159
160 def unwrapvalue(thing):
160 def unwrapvalue(context, mapping, thing):
161 """Move the inner value object out of the wrapper"""
161 """Move the inner value object out of the wrapper"""
162 if not util.safehasattr(thing, '_value'):
162 if not util.safehasattr(thing, '_value'):
163 return thing
163 return thing
@@ -327,7 +327,7 b' def evalfuncarg(context, mapping, arg):'
327 # is fixed. we can't do that right now because join() has to take a generator
327 # is fixed. we can't do that right now because join() has to take a generator
328 # of byte strings as it is, not a lazy byte string.
328 # of byte strings as it is, not a lazy byte string.
329 def _unwrapvalue(context, mapping, thing):
329 def _unwrapvalue(context, mapping, thing):
330 thing = unwrapvalue(thing)
330 thing = unwrapvalue(context, mapping, thing)
331 # evalrawexp() may return string, generator of strings or arbitrary object
331 # evalrawexp() may return string, generator of strings or arbitrary object
332 # such as date tuple, but filter does not want generator.
332 # such as date tuple, but filter does not want generator.
333 if isinstance(thing, types.GeneratorType):
333 if isinstance(thing, types.GeneratorType):
@@ -344,7 +344,7 b' def evalboolean(context, mapping, arg):'
344 thing = stringutil.parsebool(data)
344 thing = stringutil.parsebool(data)
345 else:
345 else:
346 thing = func(context, mapping, data)
346 thing = func(context, mapping, data)
347 thing = unwrapvalue(thing)
347 thing = unwrapvalue(context, mapping, thing)
348 if isinstance(thing, bool):
348 if isinstance(thing, bool):
349 return thing
349 return thing
350 # other objects are evaluated as strings, which means 0 is True, but
350 # other objects are evaluated as strings, which means 0 is True, but
General Comments 0
You need to be logged in to leave comments. Login now