Ticket #5964: urlunquote.diff
File urlunquote.diff, 1.4 KB (added by , 17 years ago) |
---|
-
django/utils/http.py
25 25 return force_unicode(urllib.quote_plus(smart_str(url), safe)) 26 26 urlquote_plus = allow_lazy(urlquote_plus, unicode) 27 27 28 def urlunquote(url_quoted): 29 """ 30 A version of Python's urllib.unquote() function that can operate on 31 the result of django's urlquote() functions. 32 """ 33 return unicode(urllib.unquote(str(url_quoted)), 'utf8') 34 urlunquote = allow_lazy(urlunquote, unicode) 35 28 36 def urlencode(query, doseq=0): 29 37 """ 30 38 A version of Python's urllib.urlencode() function that can operate on -
tests/regressiontests/text/tests.py
17 17 friends' 18 18 19 19 ### urlquote ############################################################# 20 >>> from django.utils.http import urlquote, urlquote_plus 20 >>> from django.utils.http import urlquote, urlquote_plus, urlunquote 21 21 >>> urlquote(u'Paris & Orl\xe9ans') 22 22 u'Paris%20%26%20Orl%C3%A9ans' 23 >>> urlunquote(urlquote(u'Paris & Orl\xe9ans'))==u'Paris & Orl\xe9ans' 24 True 23 25 >>> urlquote(u'Paris & Orl\xe9ans', safe="&") 24 26 u'Paris%20&%20Orl%C3%A9ans' 25 27 >>> urlquote_plus(u'Paris & Orl\xe9ans')