diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-12-28 05:11:57 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-12-28 05:11:57 +0000 |
| commit | 9319f895478c60717a7cf2cf132ad7fa4440b4f8 (patch) | |
| tree | 832f3a078b25a417776c74b0e70766a2f4825bf1 /django/db/__init__.py | |
| parent | 1d581cda674303d5b3c1d7576d31749391f1c510 (diff) | |
Fixed #12452 -- Ensured that all connections are closed when a request is finished. Thanks to samuel@lefora.com for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/__init__.py')
| -rw-r--r-- | django/db/__init__.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/db/__init__.py b/django/db/__init__.py index 2971b67dbc..ea353e4412 100644 --- a/django/db/__init__.py +++ b/django/db/__init__.py @@ -79,14 +79,15 @@ IntegrityError = backend.IntegrityError # Register an event that closes the database connection # when a Django request is finished. def close_connection(**kwargs): - connection.close() + for conn in connections.all(): + conn.close() signals.request_finished.connect(close_connection) # Register an event that resets connection.queries # when a Django request is started. def reset_queries(**kwargs): - for connection in connections.all(): - connection.queries = [] + for conn in connections.all(): + conn.queries = [] signals.request_started.connect(reset_queries) # Register an event that rolls back the connections |
