diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2022-05-12 14:13:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-12 15:13:51 +0200 |
| commit | 20e65a34aea0ace077033c84854dcf225e248f8c (patch) | |
| tree | 134d285e207b161684e313ee21d5b3d346478ba7 /django/utils | |
| parent | 3a82b5f655446f0ca89e3b6a92b100aa458f348f (diff) | |
Made closing in connection handlers more DRY.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/connection.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/utils/connection.py b/django/utils/connection.py index 5a82769cfc..a278598f25 100644 --- a/django/utils/connection.py +++ b/django/utils/connection.py @@ -79,3 +79,7 @@ class BaseConnectionHandler: # If initialized_only is True, return only initialized connections. if not initialized_only or hasattr(self._connections, alias) ] + + def close_all(self): + for conn in self.all(initialized_only=True): + conn.close() |
