Ticket #5734: utils_http_urlquote_safe.diff
File utils_http_urlquote_safe.diff, 1.2 KB (added by , 17 years ago) |
---|
-
django/utils/http.py
9 9 can safely be used as part of an argument to a subsequent iri_to_uri() call 10 10 without double-quoting occurring. 11 11 """ 12 return force_unicode(urllib.quote(smart_str(url))) 12 return force_unicode(urllib.quote(smart_str(url), safe)) 13 13 14 urlquote = allow_lazy(urlquote, unicode) 14 15 15 16 def urlquote_plus(url, safe=''): -
tests/regressiontests/text/tests.py
20 20 >>> from django.utils.http import urlquote, urlquote_plus 21 21 >>> urlquote(u'Paris & Orl\xe9ans') 22 22 u'Paris%20%26%20Orl%C3%A9ans' 23 >>> urlquote(u'Paris & Orl\xe9ans', safe="&") 24 u'Paris%20&%20Orl%C3%A9ans' 23 25 >>> urlquote_plus(u'Paris & Orl\xe9ans') 24 26 u'Paris+%26+Orl%C3%A9ans' 27 >>> urlquote_plus(u'Paris & Orl\xe9ans', safe="&") 28 u'Paris+&+Orl%C3%A9ans' 25 29 26 30 ### iri_to_uri ########################################################### 27 31 >>> from django.utils.encoding import iri_to_uri