summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2011-09-16 11:12:35 +0000
committerCarl Meyer <carl@oddbird.net>2011-09-16 11:12:35 +0000
commit568681c6da0638851b2e752167d9587f63c56193 (patch)
treee660871a660d3210b04bc892210fa3123bedf636
parente5090a3b2abadeea9f300269055e723d26f9918b (diff)
Fixed #16812 -- Percent-encode URLs in verify_exists, to fix test failures on Python 2.5 and 2.6.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16838 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/validators.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index 51ea82fba2..de415d6c2c 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -1,5 +1,6 @@
import platform
import re
+import urllib
import urllib2
import urlparse
@@ -92,6 +93,8 @@ class URLValidator(RegexValidator):
"User-Agent": self.user_agent,
}
url = url.encode('utf-8')
+ # Quote characters from the unreserved set, refs #16812
+ url = urllib.quote(url, "!*'();:@&=+$,/?#[]")
broken_error = ValidationError(
_(u'This URL appears to be a broken link.'), code='invalid_link')
try: