[Zope-Checkins] CVS: Zope/lib/python/Zope/App - startup.py:1.2.4.5
Chris McDonough
chrism@zope.com
Sun, 5 Jan 2003 02:52:29 -0500
Update of /cvs-repository/Zope/lib/python/Zope/App
In directory cvs.zope.org:/tmp/cvs-serv5589
Modified Files:
Tag: chrism-install-branch
startup.py
Log Message:
I am so confused. I thought this was already committed.
=== Zope/lib/python/Zope/App/startup.py 1.2.4.4 => 1.2.4.5 ===
--- Zope/lib/python/Zope/App/startup.py:1.2.4.4 Thu Jan 2 11:53:55 2003
+++ Zope/lib/python/Zope/App/startup.py Sun Jan 5 02:52:26 2003
@@ -30,37 +30,52 @@
import AccessControl.User
import ZPublisher
import ExtensionClass
-from Startup import getConfiguration, ConfigurationError
from zLOG import LOG, WARNING, INFO, BLATHER, log_time
-
+from Zope import Startup
def startup():
+ config = Startup.getConfiguration()
+
global ZODB, app
- Globals.BobobaseName = os.path.join(Globals.data_dir, 'Data.fs')
Globals.DatabaseVersion='3'
# Import products
OFS.Application.import_products()
- configuration = getConfiguration()
-
- databases = configuration.databases
-
- DB = None
+ # Set up a root database from zconfig data
+ zconfig_db = None
set_root = 0
- for mount_points, dbfactory in databases:
+
+ for mount_points, dbfactory in config.databases:
# only use root for now
if '/' in mount_points:
if set_root:
raise ConfigurationError, (
"Cannot specify more than one 'root' / database"
)
- DB = dbfactory()
+ zconfig_db = dbfactory()
+ Globals.BobobaseName = zconfig_db.getName()
set_root = 1
+ try:
+ # Root db/storage in custom_zodb overrides zconfig_db
+ m=imp.find_module('custom_zodb',[INSTANCE_HOME])
+ except:
+ DB = zconfig_db
+ else:
+ m=imp.load_module('Zope.custom_zodb', m[0], m[1], m[2])
+ if hasattr(m,'DB'):
+ DB=m.DB
+ else:
+ storage = m.Storage
+ DB = ZODB.DB(storage)
+
+ Globals.BobobaseName = DB.getName()
+ sys.modules['Zope.custom_zodb']=m
+
if DB is None:
- raise ConfigurationError, "Must specify a root ('/') database"
+ raise Startup.ConfigurationError, "Must specify a root ('/') database"
if DB.getActivityMonitor() is None:
from ZODB.ActivityMonitor import ActivityMonitor