Show More
@@ -161,6 +161,10 b' def buildmap(exp, context):' | |||||
161 | ctmpl = gettemplate(exp[2], context) |
|
161 | ctmpl = gettemplate(exp[2], context) | |
162 | return (runmap, (func, data, ctmpl)) |
|
162 | return (runmap, (func, data, ctmpl)) | |
163 |
|
163 | |||
|
164 | def runtemplate(context, mapping, template): | |||
|
165 | for func, data in template: | |||
|
166 | yield func(context, mapping, data) | |||
|
167 | ||||
164 | def runmap(context, mapping, data): |
|
168 | def runmap(context, mapping, data): | |
165 | func, data, ctmpl = data |
|
169 | func, data, ctmpl = data | |
166 | d = func(context, mapping, data) |
|
170 | d = func(context, mapping, data) | |
@@ -172,8 +176,7 b' def runmap(context, mapping, data):' | |||||
172 | for i in d: |
|
176 | for i in d: | |
173 | if isinstance(i, dict): |
|
177 | if isinstance(i, dict): | |
174 | lm.update(i) |
|
178 | lm.update(i) | |
175 | for f, d in ctmpl: |
|
179 | yield runtemplate(context, lm, ctmpl) | |
176 | yield f(context, lm, d) |
|
|||
177 | else: |
|
180 | else: | |
178 | # v is not an iterable of dicts, this happen when 'key' |
|
181 | # v is not an iterable of dicts, this happen when 'key' | |
179 | # has been fully expanded already and format is useless. |
|
182 | # has been fully expanded already and format is useless. | |
@@ -276,6 +279,7 b' class engine(object):' | |||||
276 | generator.''' |
|
279 | generator.''' | |
277 | return _flatten(func(self, mapping, data) for func, data in |
|
280 | return _flatten(func(self, mapping, data) for func, data in | |
278 | self._load(t)) |
|
281 | self._load(t)) | |
|
282 | return _flatten(runtemplate(self, mapping, self._load(t))) | |||
279 |
|
283 | |||
280 | engines = {'default': engine} |
|
284 | engines = {'default': engine} | |
281 |
|
285 |
General Comments 0
You need to be logged in to leave comments.
Login now