[Checkins] SVN: zc.catalogqueue/trunk/src/zc/catalogqueue/queue.
Removed evolution helper function and test, as they are no-longer
Jim Fulton
jim at zope.com
Sat May 10 13:12:27 EDT 2008
Log message for revision 86616:
Removed evolution helper function and test, as they are no-longer
needed.
Changed:
U zc.catalogqueue/trunk/src/zc/catalogqueue/queue.py
U zc.catalogqueue/trunk/src/zc/catalogqueue/queue.txt
-=-
Modified: zc.catalogqueue/trunk/src/zc/catalogqueue/queue.py
===================================================================
--- zc.catalogqueue/trunk/src/zc/catalogqueue/queue.py 2008-05-10 17:07:08 UTC (rev 86615)
+++ zc.catalogqueue/trunk/src/zc/catalogqueue/queue.py 2008-05-10 17:12:27 UTC (rev 86616)
@@ -51,6 +51,10 @@
length = self._length
except AttributeError:
length = self._length = BTrees.Length.Length()
+ change = 0
+ for queue in self._queues:
+ change += len(queue)
+
length.change(change)
def _notify(self, id, event):
@@ -90,17 +94,3 @@
self.totalProcessed += done
return done
-
-
-def addLengthSupport(queue):
- """Update an older CatalogQueue to include the length support.
-
- This should be called by generations that need to update catalog queues.
-
- """
- try:
- queue._length
- except AttributeError:
- queue._length = BTrees.Length.Length()
- for subqueue in queue._queues:
- queue._length.change(len(subqueue))
Modified: zc.catalogqueue/trunk/src/zc/catalogqueue/queue.txt
===================================================================
--- zc.catalogqueue/trunk/src/zc/catalogqueue/queue.txt 2008-05-10 17:07:08 UTC (rev 86615)
+++ zc.catalogqueue/trunk/src/zc/catalogqueue/queue.txt 2008-05-10 17:12:27 UTC (rev 86616)
@@ -195,51 +195,3 @@
Couldn't find object for 0
>>> handler.uninstall()
-
-
-Helper function
----------------
-
-``CatalogQueue`` instances created using release 0.1 will need to be updated
-before they can be used with release 0.2; this is best done as part of a
-generation.
-
-There's a helper function that can be called for catalog queues that will make
-the required changes. Let's artificially create an instance that matches what
-we'll see when a persistent catalog queue created using release 0.1 is loaded:
-
- >>> queue = zc.catalogqueue.queue.CatalogQueue()
- >>> del queue._length
-
-At this point, the ``__len__()`` method will fail:
-
- >>> len(queue)
- Traceback (most recent call last):
- AttributeError: 'CatalogQueue' object has no attribute '_length'
-
-If we use the ``addLengthSupport()`` function, it works just fine:
-
- >>> zc.catalogqueue.queue.addLengthSupport(queue)
- >>> len(queue)
- 0
-
-If the queue wasn't empty at the time of the conversion, the length will be
-properly reported after. We'll construct a legacy instance in much the same
-way:
-
- >>> queue = zc.catalogqueue.queue.CatalogQueue()
- >>> queue.add(0)
- >>> queue.add(1)
- >>> queue.add(2)
- >>> queue.update(0)
- >>> queue.update(1)
- >>> queue.remove(0)
- >>> del queue._length
-
- >>> len(queue)
- Traceback (most recent call last):
- AttributeError: 'CatalogQueue' object has no attribute '_length'
-
- >>> zc.catalogqueue.queue.addLengthSupport(queue)
- >>> len(queue)
- 3
More information about the Checkins
mailing list