Ticket #4746: 4746.patch

File 4746.patch, 1.7 KB (added by Aymeric Augustin, 13 years ago)
  • django/template/base.py

    diff --git a/django/template/base.py b/django/template/base.py
    index e2fc66b..97d22f3 100644
    a b constant_string = constant_string.replace("\n", "")  
    486486filter_raw_string = r"""
    487487^(?P<constant>%(constant)s)|
    488488^(?P<var>[%(var_chars)s]+|%(num)s)|
    489  (?:%(filter_sep)s
     489 (?:\s*%(filter_sep)s\s*
    490490     (?P<filter_name>\w+)
    491491         (?:%(arg_sep)s
    492492             (?:
  • tests/regressiontests/templates/tests.py

    diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
    index 9b6f8d4..3d26dad 100644
    a b class Templates(unittest.TestCase):  
    634634            # Chained filters
    635635            'filter-syntax02': ("{{ var|upper|lower }}", {"var": "Django is the greatest!"}, "django is the greatest!"),
    636636
    637             # Raise TemplateSyntaxError for space between a variable and filter pipe
    638             'filter-syntax03': ("{{ var |upper }}", {}, template.TemplateSyntaxError),
     637            # Allow spaces before the filter pipe
     638            'filter-syntax03': ("{{ var |upper }}", {"var": "Django is the greatest!"}, "DJANGO IS THE GREATEST!"),
    639639
    640             # Raise TemplateSyntaxError for space after a filter pipe
    641             'filter-syntax04': ("{{ var| upper }}", {}, template.TemplateSyntaxError),
     640            # Allow spaces after the filter pipe
     641            'filter-syntax04': ("{{ var| upper }}", {"var": "Django is the greatest!"}, "DJANGO IS THE GREATEST!"),
    642642
    643643            # Raise TemplateSyntaxError for a nonexistent filter
    644644            'filter-syntax05': ("{{ var|does_not_exist }}", {}, template.TemplateSyntaxError),
Back to Top