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

Hanno Schlichting <[email protected]>
Newsgroups gmane.comp.web.zope.cvs
Message-ID <20110703124558.DFEF6940C9__34934.5031813302$1309697169$gmane$org@cvs.zope.org>
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()
 

_______________________________________________
Zope-Checkins maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.