From fa2d955542b36ca8a9e863e1145a3d4ac17d1c34 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 6 Jan 2017 23:07:57 +0100 Subject: Fix various optimizer bugs. This fixes #548 --- jinja2/nodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'jinja2/nodes.py') diff --git a/jinja2/nodes.py b/jinja2/nodes.py index 6dc7e9a..d867aca 100644 --- a/jinja2/nodes.py +++ b/jinja2/nodes.py @@ -593,7 +593,7 @@ class Filter(Expr): if filter_ is None or getattr(filter_, 'contextfilter', False): raise Impossible() obj = self.node.as_const(eval_ctx) - args = [x.as_const(eval_ctx) for x in self.args] + args = [obj] + [x.as_const(eval_ctx) for x in self.args] if getattr(filter_, 'evalcontextfilter', False): args.insert(0, eval_ctx) elif getattr(filter_, 'environmentfilter', False): @@ -610,7 +610,7 @@ class Filter(Expr): except Exception: raise Impossible() try: - return filter_(obj, *args, **kwargs) + return filter_(*args, **kwargs) except Exception: raise Impossible() -- cgit v1.2.1