[Zodb-checkins] CVS: ZODB3/ZODB - FileStorage.py:1.123

Barry Warsaw barry@wooz.org
Fri, 13 Dec 2002 14:42:39 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv15450

Modified Files:
	FileStorage.py 
Log Message:
Update a comment about prev_txn

FileIterator.__len__(): Add this for Python 2.1 support.


=== ZODB3/ZODB/FileStorage.py 1.122 => 1.123 ===
--- ZODB3/ZODB/FileStorage.py:1.122	Tue Dec 10 16:40:45 2002
+++ ZODB3/ZODB/FileStorage.py	Fri Dec 13 14:42:39 2002
@@ -775,8 +775,14 @@
         # - data can be None, which indicates a George Bailey object
         #   (i.e. one who's creation has been transactionally undone).
         #
-        # If prev_txn is not None, it should contain the same data as
-        # the argument data.  If it does, write a backpointer to it.
+        # prev_txn is a backpointer.  In the original database, it's possible
+        # that the data was actually living in a previous transaction.  This
+        # can happen for transactional undo and other operations, and is used
+        # as a space saving optimization.  Under some circumstances the
+        # prev_txn may not actually exist in the target database (i.e. self)
+        # for example, if it's been packed away.  In that case, the prev_txn
+        # should be considered just a hint, and is ignored if the transaction
+        # doesn't exist.
         if self._is_read_only:
             raise POSException.ReadOnlyError()
         if transaction is not self._transaction:
@@ -2215,6 +2221,11 @@
         if start:
             self._skip_to_start(start)
         self._stop = stop
+
+    def __len__(self):
+        # This is a lie.  It's here only for Python 2.1 support for
+        # list()-ifying these objects.
+        return 0
 
     def close(self):
         file = self._file