summaryrefslogtreecommitdiff
path: root/django/utils/http.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-01-29 09:00:12 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-01-29 09:00:12 +0000
commitd9061c01a975c3313a815f793cd773d3e657c3cf (patch)
treef3691fe6c36c16f546d982791d5995599413f9b9 /django/utils/http.py
parent7ad7a8d2d32704872430a03885e1b763b2b667ad (diff)
Fixed #5964 -- Added unicode-aware versions of urlunquote and urlunquote_plus.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17407 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/http.py')
-rw-r--r--django/utils/http.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/django/utils/http.py b/django/utils/http.py
index af44ff498c..f47b58979c 100644
--- a/django/utils/http.py
+++ b/django/utils/http.py
@@ -31,7 +31,6 @@ def urlquote(url, safe='/'):
without double-quoting occurring.
"""
return force_unicode(urllib.quote(smart_str(url), smart_str(safe)))
-
urlquote = allow_lazy(urlquote, unicode)
def urlquote_plus(url, safe=''):
@@ -44,6 +43,22 @@ def urlquote_plus(url, safe=''):
return force_unicode(urllib.quote_plus(smart_str(url), smart_str(safe)))
urlquote_plus = allow_lazy(urlquote_plus, unicode)
+def urlunquote(quoted_url):
+ """
+ A wrapper for Python's urllib.unquote() function that can operate on
+ the result of django.utils.http.urlquote().
+ """
+ return force_unicode(urllib.unquote(smart_str(quoted_url)))
+urlunquote = allow_lazy(urlunquote, unicode)
+
+def urlunquote_plus(quoted_url):
+ """
+ A wrapper for Python's urllib.unquote_plus() function that can operate on
+ the result of django.utils.http.urlquote_plus().
+ """
+ return force_unicode(urllib.unquote_plus(smart_str(quoted_url)))
+urlunquote_plus = allow_lazy(urlunquote_plus, unicode)
+
def urlencode(query, doseq=0):
"""
A version of Python's urllib.urlencode() function that can operate on