summaryrefslogtreecommitdiff
path: root/django/db/utils.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-12-28 18:10:12 +0100
committerClaude Paroz <claude@2xlibre.net>2014-12-29 19:02:45 +0100
commit1d24f073e65113c8c6d974db0504ef7d083809f7 (patch)
treedae0eb0284deedc859b63ffb4f64d14ae2df4da2 /django/db/utils.py
parentbae404dea30e8bb0843db94a45d011d637ff2869 (diff)
Fixed #21255 -- Closed connections after management command ran
Thanks kabakov.as@gmail.com for the report, and Aymeric Augustin, Simon Charette for the reviews.
Diffstat (limited to 'django/db/utils.py')
-rw-r--r--django/db/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/django/db/utils.py b/django/db/utils.py
index acb90c0a1a..a355bbe466 100644
--- a/django/db/utils.py
+++ b/django/db/utils.py
@@ -252,6 +252,14 @@ class ConnectionHandler(object):
def all(self):
return [self[alias] for alias in self]
+ def close_all(self):
+ for alias in self:
+ try:
+ connection = getattr(self._connections, alias)
+ except AttributeError:
+ continue
+ connection.close()
+
class ConnectionRouter(object):
def __init__(self, routers=None):