172 return v(**mapping) |
172 return v(**mapping) |
173 if isinstance(v, types.GeneratorType): |
173 if isinstance(v, types.GeneratorType): |
174 v = list(v) |
174 v = list(v) |
175 return v |
175 return v |
176 |
176 |
|
177 def runtemplate(context, mapping, template): |
|
178 for func, data in template: |
|
179 yield func(context, mapping, data) |
|
180 |
177 def buildfilter(exp, context): |
181 def buildfilter(exp, context): |
178 func, data = compileexp(exp[1], context, methods) |
182 func, data = compileexp(exp[1], context, methods) |
179 filt = getfilter(exp[2], context) |
183 filt = getfilter(exp[2], context) |
180 return (runfilter, (func, data, filt)) |
184 return (runfilter, (func, data, filt)) |
181 |
185 |
198 |
202 |
199 def buildmap(exp, context): |
203 def buildmap(exp, context): |
200 func, data = compileexp(exp[1], context, methods) |
204 func, data = compileexp(exp[1], context, methods) |
201 ctmpl = gettemplate(exp[2], context) |
205 ctmpl = gettemplate(exp[2], context) |
202 return (runmap, (func, data, ctmpl)) |
206 return (runmap, (func, data, ctmpl)) |
203 |
|
204 def runtemplate(context, mapping, template): |
|
205 for func, data in template: |
|
206 yield func(context, mapping, data) |
|
207 |
207 |
208 def runmap(context, mapping, data): |
208 def runmap(context, mapping, data): |
209 func, data, ctmpl = data |
209 func, data, ctmpl = data |
210 d = func(context, mapping, data) |
210 d = func(context, mapping, data) |
211 if callable(d): |
211 if callable(d): |