mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Removed some Python < 2.6 compatibility code. Refs #17965.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17830 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import platform
|
||||
import re
|
||||
import urllib
|
||||
import urllib2
|
||||
@@ -123,10 +122,7 @@ class URLValidator(RegexValidator):
|
||||
else:
|
||||
handlers.append(urllib2.HTTPSHandler())
|
||||
map(opener.add_handler, handlers)
|
||||
if platform.python_version_tuple() >= (2, 6):
|
||||
opener.open(req, timeout=10)
|
||||
else:
|
||||
opener.open(req)
|
||||
opener.open(req, timeout=10)
|
||||
except ValueError:
|
||||
raise ValidationError(_(u'Enter a valid URL.'), code='invalid')
|
||||
except: # urllib2.URLError, httplib.InvalidURL, etc.
|
||||
|
||||
Reference in New Issue
Block a user