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

Chris McDonough chrism@zope.com
Wed, 7 Aug 2002 10:48:49 -0400


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

Modified Files:
	Transience.py 
Log Message:
Work around BTrees bug.

Some revision of the the BTrees code (possibly even the current head)
has a bug which causes (in this case) an OOBTree to lie about its
items.

Code like:

for key in oobtree.keys(): oobtree[key]

... will cause a KeyError when oobtree is asked to return the object
represented by key.

We work around this by explicitly detecting this problem and logging.


=== Zope/lib/python/Products/Transience/Transience.py 1.26 => 1.27 ===
                 bucket = data[k]
                 keys = bucket.keys()
                 for key in keys:
-                    self.notify_queue.put((key, bucket[key]))
+                    ob = bucket.get(key, _marker)
+                    if ob is _marker:
+                        DEBUG and TLOG(
+                            'OOBTree lied about %s keys: %s doesnt exist' %
+                            (bucket, key)
+                            )
+                        continue
+                    self.notify_queue.put((key, ob))
                 DEBUG and TLOG(
                     '_getCurrentBucket: deindexing keys %s' % list(keys))
                 keys and self._deindex(keys)