summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql_psycopg2
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-03 15:43:24 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-11 14:48:54 +0100
commit1617557ae30001cef8a863687d4bcdc28151cd50 (patch)
tree1f6f6e7820a20adb92c496c02e830f4be148432f /django/db/backends/postgresql_psycopg2
parent7b4815b455fc99a2661492f91f7242cfb09a7017 (diff)
Added BaseDatabaseWrapper.ensure_connection.
This API is useful because autocommit cannot be managed without an open connection.
Diffstat (limited to 'django/db/backends/postgresql_psycopg2')
-rw-r--r--django/db/backends/postgresql_psycopg2/base.py4
1 files changed, 0 insertions, 4 deletions
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)