aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mako/codegen.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-01-26 19:27:34 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-01-26 19:27:34 +0000
commit722047f2fe516bdec9c4c9b8491eb77bc26f2c4b (patch)
tree7affcc579dd76748942166b3a3fc62fca6d5312d /lib/mako/codegen.py
parentd608134d938280cb2669f4811ce051ff2572c896 (diff)
downloadexternal_python_mako-722047f2fe516bdec9c4c9b8491eb77bc26f2c4b.tar.gz
external_python_mako-722047f2fe516bdec9c4c9b8491eb77bc26f2c4b.tar.bz2
external_python_mako-722047f2fe516bdec9c4c9b8491eb77bc26f2c4b.zip
- small fix to local variable propigation for locals that are conditionally declared
Diffstat (limited to 'lib/mako/codegen.py')
-rw-r--r--lib/mako/codegen.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/mako/codegen.py b/lib/mako/codegen.py
index ba83f1b..a18dffc 100644
--- a/lib/mako/codegen.py
+++ b/lib/mako/codegen.py
@@ -452,7 +452,7 @@ class _GenerateRenderMethod(object):
if not self.in_def and len(self.identifiers.locally_assigned) > 0:
# if we are the "template" def, fudge locally declared/modified variables into the "__locals" dictionary,
# which is used for def calls within the same template, to simulate "enclosing scope"
- self.printer.writeline('__locals.update(dict([(k, locals()[k]) for k in [%s]]))' % ','.join([repr(x) for x in node.declared_identifiers()]))
+ self.printer.writeline('__locals.update(dict([(k, locals()[k]) for k in [%s] if k in locals()]))' % ','.join([repr(x) for x in node.declared_identifiers()]))
def visitIncludeTag(self, node):
self.write_source_comment(node)