#
import db
-from UserDict import DictMixin
+
+try:
+ from UserDict import DictMixin
+except ImportError:
+ # DictMixin is new in Python 2.3
+ class DictMixin: pass
class DBEnv:
def __init__(self, *args, **kwargs):
#------------------------------------------------------------------------
import cPickle
-from UserDict import DictMixin
+try:
+ from UserDict import DictMixin
+except ImportError:
+ # DictMixin is new in Python 2.3
+ class DictMixin: pass
try:
# For Python 2.3
from bsddb import db
#---------------------------------------------------------------------------
class DBShelf(DictMixin):
- """
- A shelf to hold pickled objects, built upon a bsddb DB object. It
+ """A shelf to hold pickled objects, built upon a bsddb DB object. It
automatically pickles/unpickles data objects going to/from the DB.
"""
def __init__(self, dbenv=None):
def __getattr__(self, name):
- """Many methods we can just pass through to the DB object. (See below)"""
+ """Many methods we can just pass through to the DB object.
+ (See below)
+ """
return getattr(self.db, name)