Author: mboersma
Date: 2008-09-04 11:41:59 -0500 (Thu, 04 Sep 2008)
New Revision: 8965

Modified:
   django/trunk/django/db/backends/oracle/base.py
Log:
Fixed re-raising of ORA-01400 as an IntegrityError in a way that works on 
Python 2.3 and 2.4 as well.

Modified: django/trunk/django/db/backends/oracle/base.py
===================================================================
--- django/trunk/django/db/backends/oracle/base.py      2008-09-04 09:50:45 UTC 
(rev 8964)
+++ django/trunk/django/db/backends/oracle/base.py      2008-09-04 16:41:59 UTC 
(rev 8965)
@@ -361,8 +361,8 @@
             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 @@
             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):


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to