summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql_psycopg2
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/postgresql_psycopg2')
-rw-r--r--django/db/backends/postgresql_psycopg2/base.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
index 9b319ad3c7..e4724e46fb 100644
--- a/django/db/backends/postgresql_psycopg2/base.py
+++ b/django/db/backends/postgresql_psycopg2/base.py
@@ -60,10 +60,11 @@ class DatabaseWrapper(local):
return cursor
def _commit(self):
- return self.connection.commit()
+ if self.connection is not None:
+ return self.connection.commit()
def _rollback(self):
- if self.connection:
+ if self.connection is not None:
return self.connection.rollback()
def close(self):