aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/Dawn/views.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/Dawn/views.py b/python/Dawn/views.py
index 8aae1cc6..f144a121 100644
--- a/python/Dawn/views.py
+++ b/python/Dawn/views.py
@@ -42,6 +42,12 @@ def get_db():
host="debian")
return db
+@app.teardown_appcontext
+def close_connection(exception):
+ db = getattr(g, '_database', None)
+ if db is not None:
+ db.close()
+
class CounterpartyForm(ModelForm):
class Meta:
model = Counterparties