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