[Zope-Checkins] SVN: Zope/trunk/ Explicitly close all databases on shutdown, which ensures `Data.fs.index` gets written to the file system.

Hanno Schlichting hannosch at hannosch.eu
Sun Jul 3 08:45:58 EDT 2011


Log message for revision 122072:
  Explicitly close all databases on shutdown, which ensures `Data.fs.index` gets written to the file system.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Zope2/App/startup.py
  U   Zope/trunk/src/Zope2/Startup/__init__.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2011-07-03 12:25:49 UTC (rev 122071)
+++ Zope/trunk/doc/CHANGES.rst	2011-07-03 12:45:58 UTC (rev 122072)
@@ -16,6 +16,9 @@
 Features Added
 ++++++++++++++
 
+- Explicitly close all databases on shutdown, which ensures `Data.fs.index`
+  gets written to the file system.
+
 - Always configure a `blob-dir` in the default skeleton.
 
 - ZPublisher: If `IBrowserPage` is provided by a view, form input is decoded.

Modified: Zope/trunk/src/Zope2/App/startup.py
===================================================================
--- Zope/trunk/src/Zope2/App/startup.py	2011-07-03 12:25:49 UTC (rev 122071)
+++ Zope/trunk/src/Zope2/App/startup.py	2011-07-03 12:45:58 UTC (rev 122072)
@@ -76,7 +76,7 @@
             m=imp.find_module('custom_zodb',[configuration.testinghome])
         except:
             m=imp.find_module('custom_zodb',[configuration.instancehome])
-    except:
+    except Exception:
         # if there is no custom_zodb, use the config file specified databases
         DB = dbtab.getDatabase('/', is_root=1)
     else:

Modified: Zope/trunk/src/Zope2/Startup/__init__.py
===================================================================
--- Zope/trunk/src/Zope2/Startup/__init__.py	2011-07-03 12:25:49 UTC (rev 122071)
+++ Zope/trunk/src/Zope2/Startup/__init__.py	2011-07-03 12:45:58 UTC (rev 122072)
@@ -107,6 +107,9 @@
             self.shutdown()
 
     def shutdown(self):
+        databases = getattr(self.cfg.dbtab, 'databases', {})
+        for db in databases.values():
+            db.close()
         self.unlinkLockFile()
         self.unlinkPidFile()
 



More information about the Zope-Checkins mailing list