[Zope-Checkins] CVS: ZODB3/ZODB - FileStorage.py:1.105.2.10

Jeremy Hylton jeremy@zope.com
Mon, 9 Dec 2002 18:47:04 -0500


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

Modified Files:
      Tag: ZODB3-3_1-branch
	FileStorage.py 
Log Message:
Add bogus __len__ to get tests work with Python 2.1.



=== ZODB3/ZODB/FileStorage.py 1.105.2.9 => 1.105.2.10 ===
--- ZODB3/ZODB/FileStorage.py:1.105.2.9	Fri Dec  6 17:59:31 2002
+++ ZODB3/ZODB/FileStorage.py	Mon Dec  9 18:47:04 2002
@@ -2271,6 +2271,14 @@
             self._skip_to_start(start)
         self._stop = stop
 
+    def __len__(self):
+        # Define a bogus __len__() to make the iterator work
+        # with code like builtin list() and tuple() in Python 2.1.
+        # There's a lot of C code that expects a sequence to have
+        # an __len__() but can cope with any sort of mistake in its
+        # implementation.  So just return 0.
+        return 0
+
     def close(self):
         file = self._file
         if file is not None: