[Python-checkins] python/dist/src/Lib/bsddb __init__.py,1.5,1.6

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri Sep 12 00:33:39 EDT 2003


Update of /cvsroot/python/python/dist/src/Lib/bsddb
In directory sc8-pr-cvs1:/tmp/cvs-serv4051/Lib/bsddb

Modified Files:
	__init__.py 
Log Message:
SF #662923

Add support for the iterator and mapping protocols.
For Py2.3, this was done for shelve, dumbdbm and other mapping objects, but
not for bsddb and dbhash which were inadvertently missed.



Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/__init__.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** __init__.py	24 Apr 2003 16:02:44 -0000	1.5
--- __init__.py	12 Sep 2003 06:33:37 -0000	1.6
***************
*** 53,58 ****
  #----------------------------------------------------------------------
  
  
! class _DBWithCursor:
      """
      A simple wrapper around DB that makes it look like the bsddbobject in
--- 53,59 ----
  #----------------------------------------------------------------------
  
+ import UserDict
  
! class _DBWithCursor(UserDict.DictMixin):
      """
      A simple wrapper around DB that makes it look like the bsddbobject in
***************
*** 145,148 ****
--- 146,157 ----
          return self.db.sync()
  
+     def __iter__(self):
+         try:
+             yield self.first()[0]
+             next = self.next
+             while 1:
+                 yield next()[0]
+         except _bsddb.DBNotFoundError:
+             return
  
  #----------------------------------------------------------------------





More information about the Python-checkins mailing list