Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3749 -- Set the context correctly when using the "filter" temp…

…late tag.

Thanks, Zak Johnson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2a512a4e83499b38fa04aa20f742afe95dbd7c3a 1 parent 43cd7bb
@malcolmt malcolmt authored
View
1  AUTHORS
@@ -113,6 +113,7 @@ answer newbie questions, and generally made Django that much better:
Tom Insam
Baurzhan Ismagulov <ibr@radix50.net>
jcrasta@gmail.com
+ Zak Johnson <zakj@nox.cx>
Michael Josephson <http://www.sdjournal.com/>
jpellerin@gmail.com
junzhang.jn@gmail.com
View
5 django/template/defaulttags.py
@@ -41,7 +41,10 @@ def __init__(self, filter_expr, nodelist):
def render(self, context):
output = self.nodelist.render(context)
# apply filters
- return self.filter_expr.resolve(Context({'var': output}))
+ context.update({'var': output})
+ filtered = self.filter_expr.resolve(context)
+ context.pop()
+ return filtered
class FirstOfNode(Node):
def __init__(self, vars):
View
1  tests/regressiontests/templates/tests.py
@@ -259,6 +259,7 @@ def test_templates(self):
'filter01': ('{% filter upper %}{% endfilter %}', {}, ''),
'filter02': ('{% filter upper %}django{% endfilter %}', {}, 'DJANGO'),
'filter03': ('{% filter upper|lower %}django{% endfilter %}', {}, 'django'),
+ 'filter04': ('{% filter cut:remove %}djangospam{% endfilter %}', {'remove': 'spam'}, 'django'),
### FIRSTOF TAG ###########################################################
'firstof01': ('{% firstof a b c %}', {'a':0,'b':0,'c':0}, ''),
Please sign in to comment.
Something went wrong with that request. Please try again.