##// END OF EJS Templates
templatekw: change joinfmt to a mandatory argument of _hybrid object...
Yuya Nishihara -
r29669:bdc81970 default
parent child Browse files
Show More
@@ -26,14 +26,11 b' from . import ('
26 # "{get(extras, key)}"
26 # "{get(extras, key)}"
27
27
28 class _hybrid(object):
28 class _hybrid(object):
29 def __init__(self, gen, values, makemap, joinfmt=None):
29 def __init__(self, gen, values, makemap, joinfmt):
30 self.gen = gen
30 self.gen = gen
31 self.values = values
31 self.values = values
32 self._makemap = makemap
32 self._makemap = makemap
33 if joinfmt:
33 self.joinfmt = joinfmt
34 self.joinfmt = joinfmt
35 else:
36 self.joinfmt = lambda x: x.values()[0]
37 def __iter__(self):
34 def __iter__(self):
38 return self.gen
35 return self.gen
39 def itermaps(self):
36 def itermaps(self):
@@ -53,7 +50,7 b' def showlist(name, values, plural=None, '
53 if not element:
50 if not element:
54 element = name
51 element = name
55 f = _showlist(name, values, plural, separator, **args)
52 f = _showlist(name, values, plural, separator, **args)
56 return _hybrid(f, values, lambda x: {element: x})
53 return _hybrid(f, values, lambda x: {element: x}, lambda d: d[element])
57
54
58 def _showlist(name, values, plural=None, separator=' ', **args):
55 def _showlist(name, values, plural=None, separator=' ', **args):
59 '''expand set of values.
56 '''expand set of values.
General Comments 0
You need to be logged in to leave comments. Login now