Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed some conditional code only needed under Python 2.6.

  • Loading branch information...
commit d5589b4cd3238c4bf4063ddd8239d22b37caa7d3 1 parent a763915
Aymeric Augustin authored July 01, 2013
12  django/conf/__init__.py
@@ -59,14 +59,10 @@ def _configure_logging(self):
59 59
         Setup logging from LOGGING_CONFIG and LOGGING settings.
60 60
         """
61 61
         if not sys.warnoptions:
62  
-            try:
63  
-                # Route warnings through python logging
64  
-                logging.captureWarnings(True)
65  
-                # Allow DeprecationWarnings through the warnings filters
66  
-                warnings.simplefilter("default", DeprecationWarning)
67  
-            except AttributeError:
68  
-                # No captureWarnings on Python 2.6, DeprecationWarnings are on anyway
69  
-                pass
  62
+            # Route warnings through python logging
  63
+            logging.captureWarnings(True)
  64
+            # Allow DeprecationWarnings through the warnings filters
  65
+            warnings.simplefilter("default", DeprecationWarning)
70 66
 
71 67
         if self.LOGGING_CONFIG:
72 68
             from django.utils.log import DEFAULT_LOGGING
10  django/db/backends/sqlite3/base.py
@@ -78,14 +78,8 @@ def decoder(conv_func):
78 78
 
79 79
 Database.register_adapter(datetime.datetime, adapt_datetime_with_timezone_support)
80 80
 Database.register_adapter(decimal.Decimal, util.rev_typecast_decimal)
81  
-if Database.version_info >= (2, 4, 1):
82  
-    # Starting in 2.4.1, the str type is not accepted anymore, therefore,
83  
-    # we convert all str objects to Unicode
84  
-    # As registering a adapter for a primitive type causes a small
85  
-    # slow-down, this adapter is only registered for sqlite3 versions
86  
-    # needing it (Python 2.6 and up).
87  
-    Database.register_adapter(str, lambda s: s.decode('utf-8'))
88  
-    Database.register_adapter(SafeBytes, lambda s: s.decode('utf-8'))
  81
+Database.register_adapter(str, lambda s: s.decode('utf-8'))
  82
+Database.register_adapter(SafeBytes, lambda s: s.decode('utf-8'))
89 83
 
90 84
 class DatabaseFeatures(BaseDatabaseFeatures):
91 85
     # SQLite cannot handle us only partially reading from a cursor's result set
4  django/db/models/fields/related.py
@@ -1362,9 +1362,7 @@ def __init__(self, to, db_constraint=True, **kwargs):
7  django/db/utils.py
@@ -85,12 +85,7 @@ def __exit__(self, exc_type, exc_value, traceback):
85 85
             ):
86 86
             db_exc_type = getattr(self.wrapper.Database, dj_exc_type.__name__)
87 87
             if issubclass(exc_type, db_exc_type):
88  
-                # Under Python 2.6, exc_value can still be a string.
89  
-                try:
90  
-                    args = tuple(exc_value.args)
91  
-                except AttributeError:
92  
-                    args = (exc_value,)
93  
-                dj_exc_value = dj_exc_type(*args)
  88
+                dj_exc_value = dj_exc_type(*exc_value.args)
94 89
                 dj_exc_value.__cause__ = exc_value
95 90
                 # Only set the 'errors_occurred' flag for errors that may make
96 91
                 # the connection unusable.

0 notes on commit d5589b4

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