[Zope3-checkins] CVS: Zope3/src/zodb/storage - base.py:1.1.2.3
Barry Warsaw
barry@wooz.org
Tue, 24 Dec 2002 11:20:03 -0500
Update of /cvs-repository/Zope3/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv3247/src/zodb/storage
Modified Files:
Tag: NameGeddon-branch
base.py
Log Message:
Wrap import of bsddb3 in a try/except and don't use it in the default
argument. Should make this robust against missing bsddb3 module.
=== Zope3/src/zodb/storage/base.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zodb/storage/base.py:1.1.2.2 Mon Dec 23 16:52:52 2002
+++ Zope3/src/zodb/storage/base.py Tue Dec 24 11:20:02 2002
@@ -327,7 +327,10 @@
# This uses the Dunn/Kuchling PyBSDDB v3 extension module available from
# http://pybsddb.sourceforge.net
-from bsddb3 import db
+try:
+ from bsddb3 import db
+except ImportError:
+ db = None
# BaseStorage provides primitives for lock acquisition and release, and a host
# of other methods, some of which are overridden here, some of which are not.
@@ -539,13 +542,15 @@
def _make_autopacker(self, event):
raise NotImplementedError
- def _setupDB(self, name, flags=0, dbtype=db.DB_BTREE, reclen=None):
+ def _setupDB(self, name, flags=0, dbtype=None, reclen=None):
"""Open an individual database with the given flags.
flags are passed directly to the underlying DB.set_flags() call.
Optional dbtype specifies the type of BerkeleyDB access method to
use. Optional reclen if not None gives the record length.
"""
+ if dbtype is None:
+ dbtype = db.DB_BTREE
d = db.DB(self._env)
if flags:
d.set_flags(flags)