]> granicus.if.org Git - python/commitdiff
SF patch #674396: Apply UserDict.DictMixin to expand dbshelve and dbojb
authorRaymond Hettinger <python@rcn.com>
Wed, 5 Feb 2003 04:12:41 +0000 (04:12 +0000)
committerRaymond Hettinger <python@rcn.com>
Wed, 5 Feb 2003 04:12:41 +0000 (04:12 +0000)
   to have a full dictionary interface.

Lib/bsddb/dbobj.py
Lib/bsddb/dbshelve.py

index 9268f5520e73cd0aa001294d3335a0762aadc6ba..f274d562ce85b388774dee204744b6273ec0670d 100644 (file)
@@ -16,6 +16,7 @@
 #
 
 import db
+from UserDict import DictMixin
 
 class DBEnv:
     def __init__(self, *args, **kwargs):
@@ -85,7 +86,7 @@ class DBEnv:
             return apply(self._cobj.set_encrypt, args, kwargs)
 
 
-class DB:
+class DB(DictMixin):
     def __init__(self, dbenv, *args, **kwargs):
         # give it the proper DBEnv C object that its expecting
         self._cobj = apply(db.DB, (dbenv._cobj,) + args, kwargs)
index d466361eebffe09a94da4f04ccc039eb6068218d..34dc607dc9f04af41059816e6ad851d640c64342 100644 (file)
@@ -30,6 +30,7 @@ storage.
 #------------------------------------------------------------------------
 
 import cPickle
+from UserDict import DictMixin
 try:
     # For Python 2.3
     from bsddb import db
@@ -75,7 +76,7 @@ def open(filename, flags=db.DB_CREATE, mode=0660, filetype=db.DB_HASH,
 
 #---------------------------------------------------------------------------
 
-class DBShelf:
+class DBShelf(DictMixin):
     """
     A shelf to hold pickled objects, built upon a bsddb DB object.  It
     automatically pickles/unpickles data objects going to/from the DB.