diff MoinMoin/app.py @ 177:9cc75ad9d6d1

infrastructure to shutdown / close resources of the app, storage, etc. storage backends now have a close() method, that shall close/free all resources used. currently, this is mostly used to dispose sqlalchemy engines.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 10 Apr 2011 22:55:56 +0200
parents 75312c9b94e3
children e73843b02d9d
line wrap: on
line diff
--- a/MoinMoin/app.py	Sun Apr 10 19:42:34 2011 +0200
+++ b/MoinMoin/app.py	Sun Apr 10 22:55:56 2011 +0200
@@ -152,6 +152,9 @@
     del clock
     return app
 
+def destroy_app(app):
+    deinit_backends(app)
+
 
 from MoinMoin.util.clock import Clock
 from MoinMoin.storage.error import StorageError
@@ -187,6 +190,10 @@
     storage = router.RouterBackend(protected_mapping, index_uri=index_uri)
     return unprotected_storage, storage
 
+def deinit_backends(app):
+    app.storage.close()
+    app.unprotected_storage.close()
+
 
 def import_export_xml(app):
     # If the content was already pumped into the backend, we don't want