Kaydet (Commit) 568681c6 authored tarafından Carl Meyer's avatar Carl Meyer

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
üst e5090a3b
import platform import platform
import re import re
import urllib
import urllib2 import urllib2
import urlparse import urlparse
...@@ -92,6 +93,8 @@ class URLValidator(RegexValidator): ...@@ -92,6 +93,8 @@ class URLValidator(RegexValidator):
"User-Agent": self.user_agent, "User-Agent": self.user_agent,
} }
url = url.encode('utf-8') url = url.encode('utf-8')
# Quote characters from the unreserved set, refs #16812
url = urllib.quote(url, "!*'();:@&=+$,/?#[]")
broken_error = ValidationError( broken_error = ValidationError(
_(u'This URL appears to be a broken link.'), code='invalid_link') _(u'This URL appears to be a broken link.'), code='invalid_link')
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment