From 651c0414a8be83785f64db7efd88837f2a0f0ce1 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 24 Mar 2012 07:36:23 +0000 Subject: [PATCH] [1.3.X] Fixed #16812 -- Percent-encode URLs in verify_exists, to fix test failures on Python 2.5 and 2.6. Backport of r16838 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@17803 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/validators.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/django/core/validators.py b/django/core/validators.py index 9dcc2bc3ab..b755509352 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 @@ -84,6 +85,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: