[Zodb-checkins] CVS: StandaloneZODB/bsddb3Storage/bsddb3Storage - Full.py:1.38
Barry Warsaw
barry@wooz.org
Thu, 24 Jan 2002 15:33:25 -0500
Update of /cvs-repository/StandaloneZODB/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv27115
Modified Files:
Full.py
Log Message:
_loadSerialEx(): When lrevid == DNE, we're looking at a George Bailey
moment, i.e. the undo of an object creation. Return None for the data
in that case.
_TransactionsIterator: Add a _closed flag which gets set in the
close() method, and checked in __getitem__(). Iterating over a closed
iterator raises an IOError.
=== StandaloneZODB/bsddb3Storage/bsddb3Storage/Full.py 1.37 => 1.38 ===
else:
version = self._versions[vid]
+ # Check for an zombification event, possible with
+ # transactionalUndo. Use data==None to specify that.
+ if lrevid == DNE:
+ return None, version
return self._pickles[oid+lrevid], version
finally:
self._lock_release()
@@ -1347,6 +1351,7 @@
def __init__(self, storage):
self._storage = storage
self._tid = None
+ self._closed = 0
def __getitem__(self, i):
"""Return the ith item in the sequence of transaction data.
@@ -1355,10 +1360,15 @@
RecordsIterator. An IndexError will be raised after all of the items
have been returned.
"""
+ if self._closed:
+ raise IOError, 'iterator is closed'
# Let IndexErrors percolate up.
tid, status, user, desc, ext = self._storage._nexttxn(self._tid)
self._tid = tid
return _RecordsIterator(self._storage, tid, status, user, desc, ext)
+
+ def close(self):
+ self._closed = 1