equal
deleted
inserted
replaced
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from i18n import _ |
8 from i18n import _ |
9 import sys, os, re |
9 import sys, os, re |
10 import util, config, templatefilters, parser, error |
10 import util, config, templatefilters, parser, error |
|
11 import types |
11 |
12 |
12 # template parsing |
13 # template parsing |
13 |
14 |
14 elements = { |
15 elements = { |
15 "(": (20, ("group", 1, ")"), ("func", 1, ")")), |
16 "(": (20, ("group", 1, ")"), ("func", 1, ")")), |
138 v = mapping.get(key) |
139 v = mapping.get(key) |
139 if v is None: |
140 if v is None: |
140 v = context._defaults.get(key, '') |
141 v = context._defaults.get(key, '') |
141 if util.safehasattr(v, '__call__'): |
142 if util.safehasattr(v, '__call__'): |
142 return v(**mapping) |
143 return v(**mapping) |
|
144 if isinstance(v, types.GeneratorType): |
|
145 v = list(v) |
|
146 mapping[key] = v |
|
147 return v |
143 return v |
148 return v |
144 |
149 |
145 def buildfilter(exp, context): |
150 def buildfilter(exp, context): |
146 func, data = compileexp(exp[1], context) |
151 func, data = compileexp(exp[1], context) |
147 filt = getfilter(exp[2], context) |
152 filt = getfilter(exp[2], context) |