From bece0317724cc5ab436e493e62b99e7d4e3de5ec Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 20 Oct 2007 08:38:59 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20#5734=20--=20Fixed=20an=20omission=20wh?= =?UTF-8?q?ere=20we=20weren't=20passing=20the=20"safe"=20argument=20upstre?= =?UTF-8?q?am=20in=20django.utils.http.urlquote().=20Thanks,=20Thomas=20G?= =?UTF-8?q?=C3=BCttler.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@6554 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/http.py | 3 ++- tests/regressiontests/text/tests.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/django/utils/http.py b/django/utils/http.py index 4c3b6af868..4912c9c46a 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -9,7 +9,8 @@ def urlquote(url, safe='/'): can safely be used as part of an argument to a subsequent iri_to_uri() call without double-quoting occurring. """ - return force_unicode(urllib.quote(smart_str(url))) + return force_unicode(urllib.quote(smart_str(url), safe)) + urlquote = allow_lazy(urlquote, unicode) def urlquote_plus(url, safe=''): diff --git a/tests/regressiontests/text/tests.py b/tests/regressiontests/text/tests.py index 0fd22b58b0..962a30ef19 100644 --- a/tests/regressiontests/text/tests.py +++ b/tests/regressiontests/text/tests.py @@ -20,8 +20,12 @@ friends' >>> from django.utils.http import urlquote, urlquote_plus >>> urlquote(u'Paris & Orl\xe9ans') u'Paris%20%26%20Orl%C3%A9ans' +>>> urlquote(u'Paris & Orl\xe9ans', safe="&") +u'Paris%20&%20Orl%C3%A9ans' >>> urlquote_plus(u'Paris & Orl\xe9ans') u'Paris+%26+Orl%C3%A9ans' +>>> urlquote_plus(u'Paris & Orl\xe9ans', safe="&") +u'Paris+&+Orl%C3%A9ans' ### iri_to_uri ########################################################### >>> from django.utils.encoding import iri_to_uri