Ticket #5983: safe_iriencode.diff
File safe_iriencode.diff, 1.6 KB (added by , 17 years ago) |
---|
-
tests/regressiontests/templates/filters.py
194 194 'filter-phone2numeric01': ('{{ a|phone2numeric }} {{ b|phone2numeric }}', {"a": "<1-800-call-me>", "b": mark_safe("<1-800-call-me>") }, "<1-800-2255-63> <1-800-2255-63>"), 195 195 'filter-phone2numeric02': ('{% autoescape off %}{{ a|phone2numeric }} {{ b|phone2numeric }}{% endautoescape %}', {"a": "<1-800-call-me>", "b": mark_safe("<1-800-call-me>") }, "<1-800-2255-63> <1-800-2255-63>"), 196 196 197 # Ensure iriencode keeps safe strings: 198 'filter-iriencode01': ('{{ url|iriencode }}', {'url': '?test=1&me=2'}, '?test=1&me=2'), 199 'filter-iriencode02': ('{{ url|iriencode }}', {'url': mark_safe('?test=1&me=2')}, '?test=1&me=2'), 200 197 201 # Chaining a bunch of safeness-preserving filters should not alter 198 202 # the safe status either way. 199 203 'chaining01': ('{{ a|capfirst|center:"7" }}.{{ b|capfirst|center:"7" }}', {"a": "a < b", "b": mark_safe("a < b")}, " A < b . A < b "), -
django/template/defaultfilters.py
107 107 """Escapes an IRI value for use in a URL.""" 108 108 return force_unicode(iri_to_uri(value)) 109 109 iriencode = stringfilter(iriencode) 110 iriencode.is_safe = True 110 111 111 112 def linenumbers(value, autoescape=None): 112 113 """Displays text with line numbers."""