[1.7.x] Fixed #22321 -- Wrapped exceptions in _set_autocommit.
Refs #21202.
Backport of 3becac84
from master
This commit is contained in:
parent
7e89434084
commit
5f22bda382
|
@ -488,6 +488,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _set_autocommit(self, autocommit):
|
def _set_autocommit(self, autocommit):
|
||||||
|
with self.wrap_database_errors:
|
||||||
self.connection.autocommit(autocommit)
|
self.connection.autocommit(autocommit)
|
||||||
|
|
||||||
def disable_constraint_checking(self):
|
def disable_constraint_checking(self):
|
||||||
|
|
|
@ -687,6 +687,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _set_autocommit(self, autocommit):
|
def _set_autocommit(self, autocommit):
|
||||||
|
with self.wrap_database_errors:
|
||||||
self.connection.autocommit = autocommit
|
self.connection.autocommit = autocommit
|
||||||
|
|
||||||
def check_constraints(self, table_names=None):
|
def check_constraints(self, table_names=None):
|
||||||
|
|
|
@ -192,6 +192,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
self.connection.set_isolation_level(isolation_level)
|
self.connection.set_isolation_level(isolation_level)
|
||||||
|
|
||||||
def _set_autocommit(self, autocommit):
|
def _set_autocommit(self, autocommit):
|
||||||
|
with self.wrap_database_errors:
|
||||||
if self.psycopg2_version >= (2, 4, 2):
|
if self.psycopg2_version >= (2, 4, 2):
|
||||||
self.connection.autocommit = autocommit
|
self.connection.autocommit = autocommit
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -411,6 +411,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
level = ''
|
level = ''
|
||||||
# 'isolation_level' is a misleading API.
|
# 'isolation_level' is a misleading API.
|
||||||
# SQLite always runs at the SERIALIZABLE isolation level.
|
# SQLite always runs at the SERIALIZABLE isolation level.
|
||||||
|
with self.wrap_database_errors:
|
||||||
self.connection.isolation_level = level
|
self.connection.isolation_level = level
|
||||||
|
|
||||||
def check_constraints(self, table_names=None):
|
def check_constraints(self, table_names=None):
|
||||||
|
|
Loading…
Reference in New Issue