Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Aymeric Augustin authored March 30, 2012
4  django/contrib/admin/tests.py
... ...
@@ -1,5 +1,3 @@
1  
-import sys
2  
-
3 1
 from django.test import LiveServerTestCase
4 2
 from django.utils.importlib import import_module
5 3
 from django.utils.unittest import SkipTest
@@ -10,8 +8,6 @@ class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
10 8
 
11 9
     @classmethod
12 10
     def setUpClass(cls):
13  
-        if sys.version_info < (2, 6):
14  
-            raise SkipTest('Selenium Webdriver does not support Python < 2.6.')
15 11
         try:
16 12
             # Import and start the WebDriver class.
17 13
             module, attr = cls.webdriver_class.rsplit('.', 1)
6  django/core/validators.py
... ...
@@ -1,4 +1,3 @@
1  
-import platform
2 1
 import re
3 2
 import urllib
4 3
 import urllib2
@@ -123,10 +122,7 @@ def __call__(self, value):
123 122
                 else:
124 123
                     handlers.append(urllib2.HTTPSHandler())
125 124
                 map(opener.add_handler, handlers)
126  
-                if platform.python_version_tuple() >= (2, 6):
127  
-                    opener.open(req, timeout=10)
128  
-                else:
129  
-                    opener.open(req)
  125
+                opener.open(req, timeout=10)
130 126
             except ValueError:
131 127
                 raise ValidationError(_(u'Enter a valid URL.'), code='invalid')
132 128
             except: # urllib2.URLError, httplib.InvalidURL, etc.
6  django/test/testcases.py
@@ -1035,12 +1035,8 @@ def run(self):
1035 1035
                     self.httpd = StoppableWSGIServer(
1036 1036
                         (self.host, port), QuietWSGIRequestHandler)
1037 1037
                 except WSGIServerException, e:
1038  
-                    if sys.version_info < (2, 6):
1039  
-                        error_code = e.args[0].args[0]
1040  
-                    else:
1041  
-                        error_code = e.args[0].errno
1042 1038
                     if (index + 1 < len(self.possible_ports) and
1043  
-                        error_code == errno.EADDRINUSE):
  1039
+                        e.args[0].errno == errno.EADDRINUSE):
1044 1040
                         # This port is already in use, so we go on and try with
1045 1041
                         # the next one in the list.
1046 1042
                         continue
23  django/utils/http.py
@@ -207,20 +207,9 @@ def quote_etag(etag):
207 207
     """
208 208
     return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"')
209 209
 
210  
-if sys.version_info >= (2, 6):
211  
-    def same_origin(url1, url2):
212  
-        """
213  
-        Checks if two URLs are 'same-origin'
214  
-        """
215  
-        p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
216  
-        return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port)
217  
-else:
218  
-    # Python 2.5 compatibility. This actually works for Python 2.6 and above,
219  
-    # but the above definition is much more obviously correct and so is
220  
-    # preferred going forward.
221  
-    def same_origin(url1, url2):
222  
-        """
223  
-        Checks if two URLs are 'same-origin'
224  
-        """
225  
-        p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
226  
-        return p1[0:2] == p2[0:2]
  210
+def same_origin(url1, url2):
  211
+    """
  212
+    Checks if two URLs are 'same-origin'
  213
+    """
  214
+    p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
  215
+    return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port)
8  tests/regressiontests/file_storage/tests.py
@@ -2,7 +2,6 @@
2 2
 import errno
3 3
 import os
4 4
 import shutil
5  
-import sys
6 5
 import tempfile
7 6
 import time
8 7
 from datetime import datetime, timedelta
@@ -470,12 +469,7 @@ def test_first_character_dot(self):
470 469
         self.storage.save('dotted.path/.test', ContentFile("2"))
471 470
 
472 471
         self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test')))
473  
-        # Before 2.6, a leading dot was treated as an extension, and so
474  
-        # underscore gets added to beginning instead of end.
475  
-        if sys.version_info < (2, 6):
476  
-            self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/_1.test')))
477  
-        else:
478  
-            self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test_1')))
  472
+        self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test_1')))
479 473
 
480 474
 class DimensionClosingBug(unittest.TestCase):
481 475
     """

0 notes on commit 4fe87c3

Please sign in to comment.
Something went wrong with that request. Please try again.