Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch '2.7-maintenance'

  • Loading branch information...
commit 4c7b51bbd0582df50a2400911071ed5109e0c31d 2 parents 8261473 + 342e88a
@mitsuhiko authored
Showing with 13 additions and 2 deletions.
  1. +7 −0 CHANGES
  2. +2 −2 jinja2/environment.py
  3. +4 −0 jinja2/testsuite/filters.py
View
7 CHANGES
@@ -1,6 +1,13 @@
Jinja2 Changelog
================
+Version 2.7.1
+-------------
+(bugfix release)
+
+- Fixed a bug with ``call_filter`` not working properly on environment
+ and context filters.
+
Version 2.7
-----------
(codename Translation, released on May 20th 2013)
View
4 jinja2/environment.py
@@ -411,7 +411,7 @@ def call_filter(self, name, value, args=None, kwargs=None,
func = self.filters.get(name)
if func is None:
raise TemplateRuntimeError('no filter named %r' % name)
- args = list(args or ())
+ args = [value] + list(args or ())
if getattr(func, 'contextfilter', False):
if context is None:
raise TemplateRuntimeError('Attempted to invoke context '
@@ -426,7 +426,7 @@ def call_filter(self, name, value, args=None, kwargs=None,
args.insert(0, eval_ctx)
elif getattr(func, 'environmentfilter', False):
args.insert(0, self)
- return func(value, *args, **(kwargs or {}))
+ return func(*args, **(kwargs or {}))
def call_test(self, name, value, args=None, kwargs=None):
"""Invokes a test on a value the same way the compiler does it.
View
4 jinja2/testsuite/filters.py
@@ -19,6 +19,10 @@
class FilterTestCase(JinjaTestCase):
+ def test_filter_calling(self):
+ rv = env.call_filter('sum', [1, 2, 3])
+ self.assert_equal(rv, 6)
+
def test_capitalize(self):
tmpl = env.from_string('{{ "foo bar"|capitalize }}')
assert tmpl.render() == 'Foo bar'
Please sign in to comment.
Something went wrong with that request. Please try again.