[Checkins] SVN: zc.catalog/trunk/ * Unit tests in other packages depend on the extentcatalog working without a

Gary Poster gary at zope.com
Fri Jan 5 10:23:29 EST 2007


Log message for revision 71716:
  * Unit tests in other packages depend on the extentcatalog working without a
    connection.  Made this story work again.
  
  

Changed:
  U   zc.catalog/trunk/CHANGES.txt
  U   zc.catalog/trunk/src/zc/catalog/extentcatalog.py
  U   zc.catalog/trunk/src/zc/catalog/extentcatalog.txt

-=-
Modified: zc.catalog/trunk/CHANGES.txt
===================================================================
--- zc.catalog/trunk/CHANGES.txt	2007-01-05 10:21:25 UTC (rev 71715)
+++ zc.catalog/trunk/CHANGES.txt	2007-01-05 15:23:29 UTC (rev 71716)
@@ -2,6 +2,15 @@
 zc.catalog changes
 ==================
 
+1.X (unreleased)
+================
+
+Bugs fixed
+----------
+
+* Unit tests in other packages depend on the extentcatalog working without a
+  connection.  Made this story work again.
+
 1.0 (2007-1-5)
 ==============
 

Modified: zc.catalog/trunk/src/zc/catalog/extentcatalog.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/extentcatalog.py	2007-01-05 10:21:25 UTC (rev 71715)
+++ zc.catalog/trunk/src/zc/catalog/extentcatalog.py	2007-01-05 15:23:29 UTC (rev 71716)
@@ -145,6 +145,8 @@
                 elif docid in self.extent:
                     super(Catalog, self).unindex_doc(docid)
                     self.extent.remove(docid)
+            self.queue.clear() # this is only necessary for using the extent
+            # catalog outside of a connection--typically, only in unit tests!
             self.queue._p_invalidate() # avoid conflict errors
             assert not self.queue
         finally:

Modified: zc.catalog/trunk/src/zc/catalog/extentcatalog.txt
===================================================================
--- zc.catalog/trunk/src/zc/catalog/extentcatalog.txt	2007-01-05 10:21:25 UTC (rev 71715)
+++ zc.catalog/trunk/src/zc/catalog/extentcatalog.txt	2007-01-05 15:23:29 UTC (rev 71716)
@@ -463,7 +463,17 @@
     >>> setSiteManager(root1['components'])
     >>> tm1.commit()
 
+Another case is that we want extentcatalogs to be able to work without a
+connection so that unit tests in other packages can work easily.
 
+    >>> extent = extentcatalog.FilterExtent(filter)
+    >>> catalog = extentcatalog.Catalog(extent)
+    >>> index = DummyIndex()
+    >>> catalog['index'] = index
+    >>> catalog.index_doc(matches[0], intid.getObject(matches[0]))
+    >>> list(catalog.extent) == list(index.uids) == [matches[0]]
+    True
+
 .. [#setup] We create the state that the text needs here.
 
     >>> import zope.app.keyreference.persistent



More information about the Checkins mailing list