Skip to content
Myr

Fixed a bug in constant folding of keyword arguments to filter calls. Thanks noskolo.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 5799605 · Browse files · 2 files+21 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+21 added−0 removed

  • tests:+18 added−0 removed
  • other:+3 added−0 removed

2 files+21 added−0 removed

modified:jinja2/nodes.py+3 added
462 unmodified lines
463class Keyword(Helper):464 """A key, value pair for keyword arguments where key is a string."""465 fields = ('key', 'value')466467 def as_const(self):468 return self.key, self.value.as_const()469470471class CondExpr(Expr):472 """A conditional expression (inline if expression). (``{{473 foo if bar else baz }}``)474 """
315 unmodified lines
added:tests/test_old_bugs.py+18 added
1# -*- coding: utf-8 -*-2"""3 Tests for old bugs4 ~~~~~~~~~~~~~~~~~~56 Unittest that test situations caused by various older bugs.78 :copyright: Copyright 2008 by Armin Ronacher.9 :license: BSD.10"""11from jinja2 import Environment1213def test_keyword_folding():14 env = Environment()15 env.filters['testing'] = lambda value, some: value + some16 assert env.from_string("{{ 'test'|testing(some='stuff') }}") \17 .render() == 'teststuff'18