From dfddf129f07a859f52f04497f6254b675a345f8d Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Mon, 2 Mar 2009 08:16:33 +0000 Subject: Fixed #9701 -- Added a "safeseq" template filter. This is like "safe", except it operates on the individual elements of a sequence, rather than treating the whole argument as a string. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9952 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/templates/filters.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/templates/filters.py b/tests/regressiontests/templates/filters.py index 5bc6430834..116ffbf131 100644 --- a/tests/regressiontests/templates/filters.py +++ b/tests/regressiontests/templates/filters.py @@ -199,6 +199,9 @@ def get_filter_tests(): 'filter-safe01': ("{{ a }} -- {{ a|safe }}", {"a": u"hello"}, "<b>hello</b> -- hello"), 'filter-safe02': ("{% autoescape off %}{{ a }} -- {{ a|safe }}{% endautoescape %}", {"a": "hello"}, u"hello -- hello"), + 'filter-safeseq01': ('{{ a|join:", " }} -- {{ a|safeseq|join:", " }}', {"a": ["&", "<"]}, "&, < -- &, <"), + 'filter-safeseq02': ('{% autoescape off %}{{ a|join:", " }} -- {{ a|safeseq|join:", " }}{% endautoescape %}', {"a": ["&", "<"]}, "&, < -- &, <"), + 'filter-removetags01': ('{{ a|removetags:"a b" }} {{ b|removetags:"a b" }}', {"a": "x

y

", "b": mark_safe("x

y

")}, u"x <p>y</p> x

y

"), 'filter-removetags02': ('{% autoescape off %}{{ a|removetags:"a b" }} {{ b|removetags:"a b" }}{% endautoescape %}', {"a": "x

y

", "b": mark_safe("x

y

")}, u"x

y

x

y

"), -- cgit v1.3