summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-05 22:30:55 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-11 14:48:55 +0100
commit09ba70f9f1844680ac0e0b3a7c38ff7113cbdb02 (patch)
tree2cabd524d6f081b0d8e49bb1409fa5d70b1a983e
parent7c46c8d5f27fe305507359588ca0635b6d87c59a (diff)
Made transaction management work even before the first SQL query.
Thanks Florian again.
-rw-r--r--django/db/backends/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 346d10198d..68551aad51 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -269,6 +269,8 @@ class BaseDatabaseWrapper(object):
"""
self.validate_no_atomic_block()
+ self.ensure_connection()
+
self.transaction_state.append(managed)
if not managed and self.is_dirty() and not forced:
@@ -286,6 +288,8 @@ class BaseDatabaseWrapper(object):
"""
self.validate_no_atomic_block()
+ self.ensure_connection()
+
if self.transaction_state:
del self.transaction_state[-1]
else: