Permalink
Browse files

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

  • Loading branch information...
1 parent e81e319 commit 86b4ac665afe793a457ae84dfa1dfbbbb7e3c2bf @aaugustin aaugustin committed May 8, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/db/backends/mysql/base.py
@@ -125,7 +125,7 @@ def execute(self, query, args=None):
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])
raise
@@ -135,7 +135,7 @@ def executemany(self, query, args):
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])
raise

0 comments on commit 86b4ac6

Please sign in to comment.