# HG changeset patch # User aflett # Date 1207588500 0 # Node ID 0cc3f1eabe13cb0d3506cf709044118cdcd999c2 # Parent 2a7a19861a8950f871f36fc18e24dff56809169e revert an optimization that made a dumb assumption about when py:matches get stored.. diff --git a/genshi/template/base.py b/genshi/template/base.py --- a/genshi/template/base.py +++ b/genshi/template/base.py @@ -25,6 +25,7 @@ from genshi.core import Attrs, Stream, StreamEventKind, START, TEXT, _ensure from genshi.input import ParseError +from genshi.template.match import MatchSet __all__ = ['Context', 'Template', 'TemplateError', 'TemplateRuntimeError', 'TemplateSyntaxError', 'BadDirectiveError'] @@ -136,7 +137,7 @@ self.frames = deque([data]) self.pop = self.frames.popleft self.push = self.frames.appendleft - self._match_set = None + self._match_set = MatchSet() self._choice_stack = [] # Helper functions for use in expressions diff --git a/genshi/template/directives.py b/genshi/template/directives.py --- a/genshi/template/directives.py +++ b/genshi/template/directives.py @@ -457,10 +457,6 @@ attach = classmethod(attach) def __call__(self, stream, directives, ctxt, **vars): - if ctxt._match_set is None: - # lazily create MatchSet so that it doesn't burden the - # _match filter when there are no py:matches defined. - ctxt._match_set = MatchSet() ctxt._match_set.add((self.path.test(ignore_context=True), self.path, list(stream), self.hints, self.namespaces, directives))