Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 4fe87c370dc7c282212c63c0502de13f411da79a 1 parent eb163f3
@aaugustin aaugustin authored
View
4 django/contrib/admin/tests.py
@@ -1,5 +1,3 @@
-import sys
-
from django.test import LiveServerTestCase
from django.utils.importlib import import_module
from django.utils.unittest import SkipTest
@@ -10,8 +8,6 @@ class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
@classmethod
def setUpClass(cls):
- if sys.version_info < (2, 6):
- raise SkipTest('Selenium Webdriver does not support Python < 2.6.')
try:
# Import and start the WebDriver class.
module, attr = cls.webdriver_class.rsplit('.', 1)
View
6 django/core/validators.py
@@ -1,4 +1,3 @@
-import platform
import re
import urllib
import urllib2
@@ -123,10 +122,7 @@ def __call__(self, value):
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.
View
6 django/test/testcases.py
@@ -1035,12 +1035,8 @@ def run(self):
self.httpd = StoppableWSGIServer(
(self.host, port), QuietWSGIRequestHandler)
except WSGIServerException, e:
- if sys.version_info < (2, 6):
- error_code = e.args[0].args[0]
- else:
- error_code = e.args[0].errno
if (index + 1 < len(self.possible_ports) and
- error_code == errno.EADDRINUSE):
+ e.args[0].errno == errno.EADDRINUSE):
# This port is already in use, so we go on and try with
# the next one in the list.
continue
View
23 django/utils/http.py
@@ -207,20 +207,9 @@ def quote_etag(etag):
"""
return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"')
-if sys.version_info >= (2, 6):
- def same_origin(url1, url2):
- """
- Checks if two URLs are 'same-origin'
- """
- p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
- return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port)
-else:
- # Python 2.5 compatibility. This actually works for Python 2.6 and above,
- # but the above definition is much more obviously correct and so is
- # preferred going forward.
- def same_origin(url1, url2):
- """
- Checks if two URLs are 'same-origin'
- """
- p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
- return p1[0:2] == p2[0:2]
+def same_origin(url1, url2):
+ """
+ Checks if two URLs are 'same-origin'
+ """
+ p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
+ return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port)
View
8 tests/regressiontests/file_storage/tests.py
@@ -2,7 +2,6 @@
import errno
import os
import shutil
-import sys
import tempfile
import time
from datetime import datetime, timedelta
@@ -470,12 +469,7 @@ def test_first_character_dot(self):
self.storage.save('dotted.path/.test', ContentFile("2"))
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test')))
- # Before 2.6, a leading dot was treated as an extension, and so
- # underscore gets added to beginning instead of end.
- if sys.version_info < (2, 6):
- self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/_1.test')))
- else:
- self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test_1')))
+ self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test_1')))
class DimensionClosingBug(unittest.TestCase):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.