Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed re-raising of ORA-01400 as an IntegrityError in a way that work…

…s on Python 2.3 and 2.4 as well.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1b396223276948339382c9d7ca84e8e0ceafd281 1 parent 3239849
Matt Boersma mboersma authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 django/db/backends/oracle/base.py
8 django/db/backends/oracle/base.py
View
@@ -361,8 +361,8 @@ def execute(self, query, params=None):
return Database.Cursor.execute(self, query, self._param_generator(params))
except DatabaseError, e:
# cx_Oracle <= 4.4.0 wrongly raises a DatabaseError for ORA-01400.
- if e.message.code == 1400 and type(e) != IntegrityError:
- e = IntegrityError(e.message)
+ if e.args[0].code == 1400 and not isinstance(e, IntegrityError):
+ e = IntegrityError(e.args[0])
raise e
def executemany(self, query, params=None):
@@ -384,8 +384,8 @@ def executemany(self, query, params=None):
return Database.Cursor.executemany(self, query, [self._param_generator(p) for p in formatted])
except DatabaseError, e:
# cx_Oracle <= 4.4.0 wrongly raises a DatabaseError for ORA-01400.
- if e.message.code == 1400 and type(e) != IntegrityError:
- e = IntegrityError(e.message)
+ if e.args[0].code == 1400 and not isinstance(e, IntegrityError):
+ e = IntegrityError(e.args[0])
raise e
def fetchone(self):
Please sign in to comment.
Something went wrong with that request. Please try again.