Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.5.x] [py3] Stopped iterating on exceptions. Refs #20025.

Backport of 86b4ac6 from master.
  • Loading branch information...
commit b5d6a5b21a2af4f0b4c3e8e3ca4b44e77812d996 1 parent 23b234a
Aymeric Augustin authored May 08, 2013

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  django/db/backends/mysql/base.py
4  django/db/backends/mysql/base.py
@@ -123,7 +123,7 @@ def execute(self, query, args=None):
123 123
         except Database.OperationalError as e:
124 124
             # Map some error codes to IntegrityError, since they seem to be
125 125
             # misclassified and Django would prefer the more logical place.
126  
-            if e[0] in self.codes_for_integrityerror:
  126
+            if e.args[0] in self.codes_for_integrityerror:
127 127
                 six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
128 128
             six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
129 129
         except Database.DatabaseError as e:
@@ -137,7 +137,7 @@ def executemany(self, query, args):
137 137
         except Database.OperationalError as e:
138 138
             # Map some error codes to IntegrityError, since they seem to be
139 139
             # misclassified and Django would prefer the more logical place.
140  
-            if e[0] in self.codes_for_integrityerror:
  140
+            if e.args[0] in self.codes_for_integrityerror:
141 141
                 six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
142 142
             six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
143 143
         except Database.DatabaseError as e:

0 notes on commit b5d6a5b

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