diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2013-02-22 19:08:35 +0100 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2013-02-22 19:19:33 +0100 |
| commit | f13bfbec70e096f230e3dcda88a2cb215e7f8899 (patch) | |
| tree | dc3caf63f0a655527abac8c0d0e53208346b55cf | |
| parent | 5488437ab69cde9161d3de3ffb4ba5eff1111792 (diff) | |
Fixed #19882 -- Smarter tokenizing of {% for %} tag arguments.
| -rw-r--r-- | django/template/defaulttags.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/templates/tests.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 7b75615c20..c1ca947753 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -746,7 +746,7 @@ def do_for(parser, token): ========================== ================================================ """ - bits = token.contents.split() + bits = token.split_contents() if len(bits) < 4: raise TemplateSyntaxError("'for' statements should have at least four" " words: %s" % token.contents) diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index 255671435a..02d3460b72 100644 --- a/tests/regressiontests/templates/tests.py +++ b/tests/regressiontests/templates/tests.py @@ -833,6 +833,8 @@ class Templates(TestCase): 'for-tag-empty01': ("{% for val in values %}{{ val }}{% empty %}empty text{% endfor %}", {"values": [1, 2, 3]}, "123"), 'for-tag-empty02': ("{% for val in values %}{{ val }}{% empty %}values array empty{% endfor %}", {"values": []}, "values array empty"), 'for-tag-empty03': ("{% for val in values %}{{ val }}{% empty %}values array not found{% endfor %}", {}, "values array not found"), + # Ticket 19882 + 'for-tag-filter-ws': ("{% for x in ''|add:'a b c' %}{{ x }}{% endfor %}", {}, 'a b c'), ### IF TAG ################################################################ 'if-tag01': ("{% if foo %}yes{% else %}no{% endif %}", {"foo": True}, "yes"), |
