[Zope-CVS] CVS: Products/DBTab - DBTab.py:1.5 MainConfiguration.py:1.4

Shane Hathaway shane@zope.com
Mon, 16 Dec 2002 15:02:36 -0500


Update of /cvs-repository/Products/DBTab
In directory cvs.zope.org:/tmp/cvs-serv30958

Modified Files:
	DBTab.py MainConfiguration.py 
Log Message:
Deferred startup until after MainConfiguration has been imported.


=== Products/DBTab/DBTab.py 1.4 => 1.5 ===
--- Products/DBTab/DBTab.py:1.4	Tue Dec 10 17:52:34 2002
+++ Products/DBTab/DBTab.py	Mon Dec 16 15:02:36 2002
@@ -244,6 +244,7 @@
     """
 
     def __init__(self, filenames, fallback_filenames=None):
+        self._started = 0
         self.filenames = filenames
         self.fallback_filenames = fallback_filenames
         self.opened = {}            # { name -> Database instance }
@@ -256,6 +257,9 @@
 
     def startup(self):
         """Opens the databases set to open_at_startup."""
+        if self._started:
+            return
+        self._started = 1
         for name, factory in self.db_factories.items():
             if factory.getOpenAtStartup():
                 self.getDatabase(name=name)
@@ -286,6 +290,7 @@
     def getDatabase(self, mount_path=None, name=None):
         """Returns an opened database.  Requires either mount_path or name.
         """
+        self.startup()
         if name is None:
             if mount_path is None:
                 raise ValueError('Either mount_path or name is required')


=== Products/DBTab/MainConfiguration.py 1.3 => 1.4 ===
--- Products/DBTab/MainConfiguration.py:1.3	Thu Oct 17 16:44:18 2002
+++ Products/DBTab/MainConfiguration.py	Mon Dec 16 15:02:36 2002
@@ -28,8 +28,6 @@
 
 configuration = DBTab([main_fn], [fallback_fn])
 
-configuration.startup()
-
 
 if 1:
     # Patch App.CacheManager so it no longer sets database cache parameters.