Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #22321 -- Wrapped exceptions in _set_autocommit.

Refs #21202.
  • Loading branch information...
commit 3becac84845cee8f12a5fb7f68c87cbaf029c6a0 1 parent d5031ec
@aaugustin aaugustin authored
View
3  django/db/backends/mysql/base.py
@@ -488,7 +488,8 @@ def _rollback(self):
pass
def _set_autocommit(self, autocommit):
- self.connection.autocommit(autocommit)
+ with self.wrap_database_errors:
+ self.connection.autocommit(autocommit)
def disable_constraint_checking(self):
"""
View
3  django/db/backends/oracle/base.py
@@ -687,7 +687,8 @@ def _savepoint_commit(self, sid):
pass
def _set_autocommit(self, autocommit):
- self.connection.autocommit = autocommit
+ with self.wrap_database_errors:
+ self.connection.autocommit = autocommit
def check_constraints(self, table_names=None):
"""
View
15 django/db/backends/postgresql_psycopg2/base.py
@@ -189,14 +189,15 @@ def _set_isolation_level(self, isolation_level):
self.connection.set_isolation_level(isolation_level)
def _set_autocommit(self, autocommit):
- if self.psycopg2_version >= (2, 4, 2):
- self.connection.autocommit = autocommit
- else:
- if autocommit:
- level = psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT
+ with self.wrap_database_errors:
+ if self.psycopg2_version >= (2, 4, 2):
+ self.connection.autocommit = autocommit
else:
- level = self.isolation_level
- self.connection.set_isolation_level(level)
+ if autocommit:
+ level = psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT
+ else:
+ level = self.isolation_level
+ self.connection.set_isolation_level(level)
def check_constraints(self, table_names=None):
"""
View
3  django/db/backends/sqlite3/base.py
@@ -411,7 +411,8 @@ def _set_autocommit(self, autocommit):
level = ''
# 'isolation_level' is a misleading API.
# SQLite always runs at the SERIALIZABLE isolation level.
- self.connection.isolation_level = level
+ with self.wrap_database_errors:
+ self.connection.isolation_level = level
def check_constraints(self, table_names=None):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.