1
0
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:
Aymeric Augustin
2012-03-30 09:20:04 +00:00
parent eb163f37cb
commit 4fe87c370d
5 changed files with 9 additions and 38 deletions

View File

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