From: Armin Ronacher Date: Wed, 9 Apr 2008 13:03:33 +0000 (+0200) Subject: Automated merge with ssh://team@pocoo.org/jinja2-main X-Git-Tag: 2.0rc1~198 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=96beb07f88584063a4122111870f284a1d74aac4;p=jinja2.git Automated merge with ssh://team@pocoo.org/jinja2-main --HG-- branch : trunk --- 96beb07f88584063a4122111870f284a1d74aac4 diff --cc jinja2/optimizer.py index 592a294,e98431c..ee2f082 --- a/jinja2/optimizer.py +++ b/jinja2/optimizer.py @@@ -76,12 -76,9 +76,12 @@@ class Optimizer(NodeTransformer) return self.generic_visit(node, context) for filter in reversed(node.filters): # XXX: call filters with arguments - x = self.environment.filters[filter.name](self.environment, x) + x = self.environment.filters[filter.name](x) # XXX: don't optimize context dependent filters - return nodes.Const(x) + try: + return nodes.Const.from_untrusted(x, lineno=node.lineno) + except nodes.Impossible: + return self.generic_visit(node) def visit_For(self, node, context): """Loop unrolling for iterable constant values."""