diff options
Diffstat (limited to 'jinja2/nodes.py')
-rw-r--r-- | jinja2/nodes.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/jinja2/nodes.py b/jinja2/nodes.py index 058e3e6..e46aa91 100644 --- a/jinja2/nodes.py +++ b/jinja2/nodes.py @@ -768,13 +768,19 @@ class Compare(Expr): def as_const(self, eval_ctx=None): eval_ctx = get_eval_context(self, eval_ctx) result = value = self.expr.as_const(eval_ctx) + try: for op in self.ops: new_value = op.expr.as_const(eval_ctx) result = _cmpop_to_func[op.op](value, new_value) + + if not result: + return False + value = new_value except Exception: raise Impossible() + return result |