again documentation updates fixed another python 2.4 bug. Imports are not evaluated with the template context any longer which makes it possible to keep them in memory
--HG--
branch : trunk
diff --git a/jinja2/ext.py b/jinja2/ext.py
index 1158505..bc04a69 100644
--- a/jinja2/ext.py
+++ b/jinja2/ext.py
@@ -199,8 +199,6 @@
gettext = nodes.Name('gettext', 'load')
node = nodes.Call(gettext, [nodes.Const(singular)],
[], None, None)
- if variables:
- node = nodes.Mod(node, variables)
# singular and plural
else:
@@ -210,8 +208,14 @@
nodes.Const(plural),
plural_expr
], [], None, None)
- if variables:
- node = nodes.Mod(node, variables)
+
+ # mark the return value as safe if we are in an
+ # environment with autoescaping turned on
+ if self.environment.autoescape:
+ node = nodes.MarkSafe(node)
+
+ if variables:
+ node = nodes.Mod(node, variables)
return nodes.Output([node])