Mercurial > genshi > mirror
comparison genshi/template/base.py @ 717:0e8b92905741 experimental-match-fastpaths
a performance breakthrough - bring this branch inline with the bigtable benchmark by lazily creating ctxt._match_set in a way that doesn't barf
author | aflett |
---|---|
date | Tue, 08 Apr 2008 23:36:20 +0000 |
parents | 0cc3f1eabe13 |
children | d143dd73789b |
comparison
equal
deleted
inserted
replaced
712:b33c14a1f579 | 717:0e8b92905741 |
---|---|
23 from StringIO import StringIO | 23 from StringIO import StringIO |
24 import sys | 24 import sys |
25 | 25 |
26 from genshi.core import Attrs, Stream, StreamEventKind, START, TEXT, _ensure | 26 from genshi.core import Attrs, Stream, StreamEventKind, START, TEXT, _ensure |
27 from genshi.input import ParseError | 27 from genshi.input import ParseError |
28 from genshi.template.match import MatchSet | |
29 | 28 |
30 __all__ = ['Context', 'Template', 'TemplateError', 'TemplateRuntimeError', | 29 __all__ = ['Context', 'Template', 'TemplateError', 'TemplateRuntimeError', |
31 'TemplateSyntaxError', 'BadDirectiveError'] | 30 'TemplateSyntaxError', 'BadDirectiveError'] |
32 __docformat__ = 'restructuredtext en' | 31 __docformat__ = 'restructuredtext en' |
33 | 32 |
135 data. | 134 data. |
136 """ | 135 """ |
137 self.frames = deque([data]) | 136 self.frames = deque([data]) |
138 self.pop = self.frames.popleft | 137 self.pop = self.frames.popleft |
139 self.push = self.frames.appendleft | 138 self.push = self.frames.appendleft |
140 self._match_set = MatchSet() | 139 self._match_set = None |
141 self._choice_stack = [] | 140 self._choice_stack = [] |
142 | 141 |
143 # Helper functions for use in expressions | 142 # Helper functions for use in expressions |
144 def defined(name): | 143 def defined(name): |
145 """Return whether a variable with the specified name exists in the | 144 """Return whether a variable with the specified name exists in the |