comparison genshi/template/directives.py @ 687:50adceceff07 experimental-match-fastpaths

land first cut at fast-path matching - needs some cleanup
author aflett
date Mon, 25 Feb 2008 20:44:04 +0000
parents 2a52ea05fe9f
children 3a4f2fd6f5e2
comparison
equal deleted inserted replaced
686:f6bff60c9fa8 687:50adceceff07
448 return cls(value, template, frozenset(hints), namespaces, *pos[1:]), \ 448 return cls(value, template, frozenset(hints), namespaces, *pos[1:]), \
449 stream 449 stream
450 attach = classmethod(attach) 450 attach = classmethod(attach)
451 451
452 def __call__(self, stream, ctxt, directives): 452 def __call__(self, stream, ctxt, directives):
453 ctxt._match_templates.append((self.path.test(ignore_context=True), 453 ctxt._match_set.add((self.path.test(ignore_context=True),
454 self.path, list(stream), self.hints, 454 self.path, list(stream), self.hints,
455 self.namespaces, directives)) 455 self.namespaces, directives))
456 return [] 456 return []
457 457
458 def __repr__(self): 458 def __repr__(self):
459 return '<%s "%s">' % (self.__class__.__name__, self.path.source) 459 return '<%s "%s">' % (self.__class__.__name__, self.path.source)
460 460
Copyright (C) 2012-2017 Edgewall Software