From b0f4eecfa74a71ec3e968df21d0ac6658ec03d8c Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Thu, 24 Apr 2014 08:42:30 +0200 Subject: [PATCH] Ignored repeated calls to connection.close(). Forwardport of 9bbb43dd1a from stable/1.7.x --- django/db/backends/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 1794edabb0..96e249a079 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -183,6 +183,8 @@ class BaseDatabaseWrapper(object): # Don't call validate_no_atomic_block() to avoid making it difficult # to get rid of a connection in an invalid state. The next connect() # will reset the transaction state anyway. + if self.closed_in_transaction or self.connection is None: + return try: self._close() finally: