Skip to content

Commit

Permalink
Fixed #4746 -- Allowed spaces around filter separator.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Apr 30, 2012
1 parent 78ba967 commit ddfc7c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion django/template/base.py
Expand Up @@ -486,7 +486,7 @@ def next_space_index(subject, i):
filter_raw_string = r"""
^(?P<constant>%(constant)s)|
^(?P<var>[%(var_chars)s]+|%(num)s)|
(?:%(filter_sep)s
(?:\s*%(filter_sep)s\s*
(?P<filter_name>\w+)
(?:%(arg_sep)s
(?:
Expand Down
8 changes: 4 additions & 4 deletions tests/regressiontests/templates/tests.py
Expand Up @@ -634,11 +634,11 @@ def get_template_tests(self):
# Chained filters
'filter-syntax02': ("{{ var|upper|lower }}", {"var": "Django is the greatest!"}, "django is the greatest!"),

# Raise TemplateSyntaxError for space between a variable and filter pipe
'filter-syntax03': ("{{ var |upper }}", {}, template.TemplateSyntaxError),
# Allow spaces before the filter pipe
'filter-syntax03': ("{{ var |upper }}", {"var": "Django is the greatest!"}, "DJANGO IS THE GREATEST!"),

# Raise TemplateSyntaxError for space after a filter pipe
'filter-syntax04': ("{{ var| upper }}", {}, template.TemplateSyntaxError),
# Allow spaces after the filter pipe
'filter-syntax04': ("{{ var| upper }}", {"var": "Django is the greatest!"}, "DJANGO IS THE GREATEST!"),

# Raise TemplateSyntaxError for a nonexistent filter
'filter-syntax05': ("{{ var|does_not_exist }}", {}, template.TemplateSyntaxError),
Expand Down

0 comments on commit ddfc7c2

Please sign in to comment.