mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Switched {% cycle %} and {% firstof %} tags to auto-escape their variables per deprecation timeline.
refs #17906.
This commit is contained in:
parent
274048351a
commit
1ea44a3abd
4 changed files with 28 additions and 81 deletions
|
|
@ -883,13 +883,13 @@ class TemplateTests(TestCase):
|
|||
'cycle17': ("{% cycle 'a' 'b' 'c' as abc silent %}{% cycle abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}", {}, ""),
|
||||
'cycle18': ("{% cycle 'a' 'b' 'c' as foo invalid_flag %}", {}, template.TemplateSyntaxError),
|
||||
'cycle19': ("{% cycle 'a' 'b' as silent %}{% cycle silent %}", {}, "ab"),
|
||||
'cycle20': ("{% cycle one two as foo %} & {% cycle foo %}", {'one': 'A & B', 'two': 'C & D'}, "A & B & C & D"),
|
||||
'cycle21': ("{% filter force_escape %}{% cycle one two as foo %} & {% cycle foo %}{% endfilter %}", {'one': 'A & B', 'two': 'C & D'}, "A & B & C & D"),
|
||||
'cycle20': ("{% cycle one two as foo %} & {% cycle foo %}", {'one': 'A & B', 'two': 'C & D'}, "A & B & C & D"),
|
||||
'cycle21': ("{% filter force_escape %}{% cycle one two as foo %} & {% cycle foo %}{% endfilter %}", {'one': 'A & B', 'two': 'C & D'}, "A & B & C & D"),
|
||||
'cycle22': ("{% for x in values %}{% cycle 'a' 'b' 'c' as abc silent %}{{ x }}{% endfor %}", {'values': [1, 2, 3, 4]}, "1234"),
|
||||
'cycle23': ("{% for x in values %}{% cycle 'a' 'b' 'c' as abc silent %}{{ abc }}{{ x }}{% endfor %}", {'values': [1, 2, 3, 4]}, "a1b2c3a4"),
|
||||
'included-cycle': ('{{ abc }}', {'abc': 'xxx'}, 'xxx'),
|
||||
'cycle24': ("{% for x in values %}{% cycle 'a' 'b' 'c' as abc silent %}{% include 'included-cycle' %}{% endfor %}", {'values': [1, 2, 3, 4]}, "abca"),
|
||||
'cycle25': ('{% cycle a as abc %}', {'a': '<'}, '<'),
|
||||
'cycle25': ('{% cycle a as abc %}', {'a': '<'}, '<'),
|
||||
|
||||
'cycle26': ('{% load cycle from future %}{% cycle a b as ab %}{% cycle ab %}', {'a': '<', 'b': '>'}, '<>'),
|
||||
'cycle27': ('{% load cycle from future %}{% autoescape off %}{% cycle a b as ab %}{% cycle ab %}{% endautoescape %}', {'a': '<', 'b': '>'}, '<>'),
|
||||
|
|
@ -929,7 +929,7 @@ class TemplateTests(TestCase):
|
|||
'firstof07': ('{% firstof a b "c" %}', {'a': 0}, 'c'),
|
||||
'firstof08': ('{% firstof a b "c and d" %}', {'a': 0, 'b': 0}, 'c and d'),
|
||||
'firstof09': ('{% firstof %}', {}, template.TemplateSyntaxError),
|
||||
'firstof10': ('{% firstof a %}', {'a': '<'}, '<'),
|
||||
'firstof10': ('{% firstof a %}', {'a': '<'}, '<'),
|
||||
|
||||
'firstof11': ('{% load firstof from future %}{% firstof a b %}', {'a': '<', 'b': '>'}, '<'),
|
||||
'firstof12': ('{% load firstof from future %}{% firstof a b %}', {'a': '', 'b': '>'}, '>'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue