comparison genshi/template/eval.py @ 803:92b9b647e1fe

`for` loops in template code blocks should not establish their own locals block. Closes #259.
author cmlenz
date Thu, 05 Mar 2009 10:05:12 +0000
parents aa274188b77a
children 9871e6ca89b0
comparison
equal deleted inserted replaced
802:aa274188b77a 803:92b9b647e1fe
515 try: 515 try:
516 return ASTTransformer.visit_ClassDef(self, node) 516 return ASTTransformer.visit_ClassDef(self, node)
517 finally: 517 finally:
518 self.locals.pop() 518 self.locals.pop()
519 519
520 def visit_For(self, node):
521 self.locals.append(set())
522 try:
523 return ASTTransformer.visit_For(self, node)
524 finally:
525 self.locals.pop()
526
527 def visit_ImportFrom(self, node): 520 def visit_ImportFrom(self, node):
528 if not has_star_import_bug or [a.name for a in node.names] != ['*']: 521 if not has_star_import_bug or [a.name for a in node.names] != ['*']:
529 # This is a Python 2.4 bug. Only if we have a broken Python 522 # This is a Python 2.4 bug. Only if we have a broken Python
530 # version we have to apply the hack 523 # version we have to apply the hack
531 return node 524 return node
Copyright (C) 2012-2017 Edgewall Software