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
This commit is contained in:
Carl Meyer 2011-09-16 11:12:35 +00:00
parent e5090a3b2a
commit 568681c6da
1 changed files with 3 additions and 0 deletions

View File

@ -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: