[Zope-Checkins] CVS: Zope/lib/python/Products/Transience - Transience.py:1.33.2.2

Jim Fulton cvs-admin at zope.org
Thu Nov 27 10:34:27 EST 2003


Update of /cvs-repository/Zope/lib/python/Products/Transience
In directory cvs.zope.org:/tmp/cvs-serv7869/lib/python/Products/Transience

Modified Files:
      Tag: Zope-2_8-devel-branch
	Transience.py 
Log Message:
Got tests to pass except test that was previously (and still) failing
on head.


=== Zope/lib/python/Products/Transience/Transience.py 1.33.2.1 => 1.33.2.2 ===
--- Zope/lib/python/Products/Transience/Transience.py:1.33.2.1	Tue Nov 25 15:17:37 2003
+++ Zope/lib/python/Products/Transience/Transience.py	Thu Nov 27 10:33:56 2003
@@ -427,6 +427,12 @@
             # our "__len__" is the length of _index.
             # we need to maintain the length of the index structure separately
             # because getting the length of a BTree is very expensive.
+            # Note that it is a mistake to use the __len__ attr this way,
+            # because length methods are cached in C slots and out instance
+            # attr won't be used for len(foo) in new-style classes.
+            # See the __len__ method below. I (Jim) am not changing this now
+            # on account of ols instances. With some effort, we could fix this,
+            # bit I'm not up for it now.
             try:
                 self.__len__.set(0)
             except AttributeError:
@@ -439,6 +445,9 @@
             self._deindex_next=Increaser(self._getCurrentTimeslice())
         finally:
             self.lock.release()
+
+    def __len__(self):
+        return self.__dict__['__len__']()
 
     def getLen(self):
         return self.__len__




More information about the Zope-Checkins mailing list