[Zope3-checkins] CVS: Zope3/src/zope/app/startup - sitedefinition.py:1.18
Barry Warsaw
barry@zope.com
Mon, 23 Jun 2003 15:46:07 -0400
Update of /cvs-repository/Zope3/src/zope/app/startup
In directory cvs.zope.org:/tmp/cvs-serv3760
Modified Files:
sitedefinition.py
Log Message:
useBDBFullStorage(): Until I understand Jeremy's intent with the
config.py 1.4 changes, this at least fixes BDBFullStorage so that it
works under Zope3 again.
=== Zope3/src/zope/app/startup/sitedefinition.py 1.17 => 1.18 ===
--- Zope3/src/zope/app/startup/sitedefinition.py:1.17 Fri Jun 6 15:42:56 2003
+++ Zope3/src/zope/app/startup/sitedefinition.py Mon Jun 23 15:46:06 2003
@@ -108,20 +108,35 @@
self._zodb = DB(MappingStorage())
return []
- def useBDBFullStorage(self, _context, **kws):
+ def _makeConfig(self, kws):
+ def asbool(s):
+ ss = s.lower()
+ if ss in ('yes', 'true', 'on'):
+ return True
+ if ss in ('no', 'false', 'off'):
+ return False
+ raise ValueError('not a valid boolean value: %s' % repr(s))
+
+ from zodb.storage.base import BerkeleyConfig
+ config = BerkeleyConfig()
+ for k, v in kws.items():
+ if k == 'read_only':
+ v = asbool(v)
+ elif k <> 'logdir':
+ v = int(v)
+ setattr(config, k, v)
+ return config
+
+ def useBDBFullStorage(self, _context, name, **kws):
"""Specify a Berkeley full storage."""
- from zodb.config import convertBDBStorageArgs
from zodb.storage.bdbfull import BDBFullStorage
- kws = convertBDBStorageArgs(**kws)
- self._zodb = DB(BDBFullStorage(**kws), cache_size=4000)
+ self._zodb = DB(BDBFullStorage(name, config=self._makeConfig(kws)))
return []
- def useMemoryFullStorage(self, _context, **kws):
+ def useMemoryFullStorage(self, _context, name, **kws):
"""Specify a full memory storage."""
- from zodb.config import convertBDBStorageArgs
from zodb.storage.memory import MemoryFullStorage
- kws = convertBDBStorageArgs(**kws)
- self._zodb = DB(MemoryFullStorage(**kws))
+ self._zodb = DB(MemoryFullStorage(name, config=self._makeConfig(kws)))
return []