[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/StartUp - SiteDefinition.py:1.13

Jeremy Hylton jeremy@zope.com
Fri, 20 Dec 2002 14:46:02 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/StartUp
In directory cvs.zope.org:/tmp/cvs-serv13550

Modified Files:
	SiteDefinition.py 
Log Message:
Add close() method to SiteDefinition


=== Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py 1.12 => 1.13 ===
--- Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py:1.12	Thu Dec 19 21:39:30 2002
+++ Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py	Fri Dec 20 14:46:01 2002
@@ -74,10 +74,16 @@
 
         self._started = 0
 
+    def close(self):
+        if self._zodb is not None:
+            self._zodb.close()
+            self._zodb = None
 
     def useFileStorage(self, _context, file=DEFAULT_STORAGE_FILE):
         """Lets you specify the ZODB to use."""
         from ZODB.FileStorage import DB
+        if self._zodb is not None:
+            raise RuntimeError("Database already open")
         self._zodb = DB(file)
         return []
 
@@ -85,6 +91,8 @@
     def useMappingStorage(self, _context):
         """Lets you specify the ZODB to use."""
         from ZODB.MappingStorage import DB
+        if self._zodb is not None:
+            raise RuntimeError("Database already open")
         self._zodb = DB()
         return []