From cfdad9ed86c8408fe69fd0a946419f9c8aa265c8 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sat, 23 Oct 2010 00:01:22 +0000 Subject: Fixed #14223 -- Extended unification of exception raised in presence of integrity constraint violations. The unification had been introduced in r12352 and native backend exceptions still slipped through in cases that end in connection.commit() call. Thanks Alex, Jacob and Carl for reviewing. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14320 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/postgresql/base.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'django/db/backends/postgresql') diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 5e47a37d3f..12631785bc 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -153,6 +153,13 @@ class DatabaseWrapper(BaseDatabaseWrapper): cursor.execute("SET client_encoding to 'UNICODE'") return UnicodeCursorWrapper(cursor, 'utf-8') + def _commit(self): + if self.connection is not None: + try: + return self.connection.commit() + except Database.IntegrityError, e: + raise utils.IntegrityError, utils.IntegrityError(*tuple(e)), sys.exc_info()[2] + def typecast_string(s): """ Cast all returned strings to unicode strings. -- cgit v1.3