Show More
@@ -43,19 +43,17 class engine(object): | |||
|
43 | 43 | {key|filter1|filter2|...}.''' |
|
44 | 44 | |
|
45 | 45 | def __init__(self, loader, filters={}, defaults={}): |
|
46 | self.loader = loader | |
|
47 | self.filters = filters | |
|
48 | self.defaults = defaults | |
|
49 | self.cache = {} | |
|
50 | self.parsecache = {} | |
|
46 | self._loader = loader | |
|
47 | self._filters = filters | |
|
48 | self._defaults = defaults | |
|
49 | self._cache = {} | |
|
51 | 50 | |
|
52 | 51 | def process(self, t, mapping): |
|
53 | 52 | '''Perform expansion. t is name of map element to expand. mapping contains |
|
54 | 53 | added elements for use during expansion. Is a generator.''' |
|
55 |
if t not in self. |
|
|
56 |
|
|
|
57 |
|
|
|
58 | parsed = self.parsecache[t] | |
|
54 | if t not in self._cache: | |
|
55 | self._cache[t] = self._parse(self._loader(t)) | |
|
56 | parsed = self._cache[t] | |
|
59 | 57 | iters = [self._process(parsed, mapping)] |
|
60 | 58 | while iters: |
|
61 | 59 | try: |
@@ -139,7 +137,7 class engine(object): | |||
|
139 | 137 | parts = expr.split('|') |
|
140 | 138 | val = parts[0] |
|
141 | 139 | try: |
|
142 | filters = [self.filters[f] for f in parts[1:]] | |
|
140 | filters = [self._filters[f] for f in parts[1:]] | |
|
143 | 141 | except KeyError, i: |
|
144 | 142 | raise SyntaxError(_("unknown filter '%s'") % i[0]) |
|
145 | 143 | parsed.append((filt, (filters, val))) |
General Comments 0
You need to be logged in to leave comments.
Login now