##// END OF EJS Templates
templater: drop unneeded generator from mappable object...
Yuya Nishihara -
r37294:b4630e33 default
parent child Browse files
Show More
@@ -113,15 +113,11 b' class mappable(wrapped):'
113 113 """
114 114
115 115 def __init__(self, gen, key, value, makemap):
116 if gen is not None:
117 self._gen = gen # generator or function returning generator
116 self._gen = gen # generator or function returning generator
118 117 self._key = key
119 118 self._value = value # may be generator of strings
120 119 self._makemap = makemap
121 120
122 def _gen(self):
123 yield pycompat.bytestr(self._value)
124
125 121 def tomap(self):
126 122 return self._makemap(self._key)
127 123
@@ -131,6 +127,8 b' class mappable(wrapped):'
131 127 def show(self, context, mapping):
132 128 # TODO: switch gen to (context, mapping) API?
133 129 gen = self._gen
130 if gen is None:
131 return pycompat.bytestr(self._value)
134 132 if callable(gen):
135 133 return gen()
136 134 return gen
General Comments 0
You need to be logged in to leave comments. Login now