summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-05-08 12:56:50 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-05-10 10:18:27 +0200
commitb5d6a5b21a2af4f0b4c3e8e3ca4b44e77812d996 (patch)
tree35df25396386c91a961950c425a112d7fd909cfd
parent23b234a9d9ea26acb9bb12ba14231ce8844d2e53 (diff)
[1.5.x] [py3] Stopped iterating on exceptions. Refs #20025.
Backport of 86b4ac66 from master.
-rw-r--r--django/db/backends/mysql/base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index 158d936c40..65db3b6acb 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -123,7 +123,7 @@ class CursorWrapper(object):
except Database.OperationalError as e:
# Map some error codes to IntegrityError, since they seem to be
# misclassified and Django would prefer the more logical place.
- if e[0] in self.codes_for_integrityerror:
+ if e.args[0] in self.codes_for_integrityerror:
six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
except Database.DatabaseError as e:
@@ -137,7 +137,7 @@ class CursorWrapper(object):
except Database.OperationalError as e:
# Map some error codes to IntegrityError, since they seem to be
# misclassified and Django would prefer the more logical place.
- if e[0] in self.codes_for_integrityerror:
+ if e.args[0] in self.codes_for_integrityerror:
six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
except Database.DatabaseError as e: