From 1617557ae30001cef8a863687d4bcdc28151cd50 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sun, 3 Mar 2013 15:43:24 +0100 Subject: Added BaseDatabaseWrapper.ensure_connection. This API is useful because autocommit cannot be managed without an open connection. --- django/db/backends/postgresql_psycopg2/base.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'django/db/backends/postgresql_psycopg2/base.py') diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index cc1d1ae567..384b38cc58 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -169,8 +169,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): Switch the isolation level when needing transaction support, so that the same transaction is visible across all the queries. """ - if self.connection is None: # Force creating a connection. - self.cursor().close() if managed and self.autocommit: self.set_autocommit(False) @@ -179,8 +177,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): If the normal operating mode is "autocommit", switch back to that when leaving transaction management. """ - if self.connection is None: # Force creating a connection. - self.cursor().close() if not managed and not self.autocommit: self.rollback() # Must terminate transaction first. self.set_autocommit(True) -- cgit v1.3