[Checkins] SVN: Products.ZCatalog/trunk/ Fixed the BooleanIndex to not index objects without the cataloged attribute.
Hanno Schlichting
hannosch at hannosch.eu
Mon Mar 28 09:15:43 EDT 2011
Log message for revision 121142:
Fixed the BooleanIndex to not index objects without the cataloged attribute.
Changed:
U Products.ZCatalog/trunk/CHANGES.txt
U Products.ZCatalog/trunk/src/Products/PluginIndexes/BooleanIndex/BooleanIndex.py
U Products.ZCatalog/trunk/src/Products/PluginIndexes/BooleanIndex/tests.py
-=-
Modified: Products.ZCatalog/trunk/CHANGES.txt
===================================================================
--- Products.ZCatalog/trunk/CHANGES.txt 2011-03-28 13:11:30 UTC (rev 121141)
+++ Products.ZCatalog/trunk/CHANGES.txt 2011-03-28 13:15:43 UTC (rev 121142)
@@ -4,6 +4,7 @@
2.13.8 (unreleased)
-------------------
+- Fixed the BooleanIndex to not index objects without the cataloged attribute.
2.13.7 (2011-02-15)
-------------------
Modified: Products.ZCatalog/trunk/src/Products/PluginIndexes/BooleanIndex/BooleanIndex.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/PluginIndexes/BooleanIndex/BooleanIndex.py 2011-03-28 13:11:30 UTC (rev 121141)
+++ Products.ZCatalog/trunk/src/Products/PluginIndexes/BooleanIndex/BooleanIndex.py 2011-03-28 13:15:43 UTC (rev 121142)
@@ -20,9 +20,9 @@
from ZODB.POSException import ConflictError
from Products.PluginIndexes.common.util import parseIndexRequest
+from Products.PluginIndexes.common.UnIndex import _marker
from Products.PluginIndexes.common.UnIndex import UnIndex
-_marker = object()
LOG = getLogger('BooleanIndex.UnIndex')
@@ -86,7 +86,8 @@
datum = self._get_object_datum(obj, attr)
# Make it boolean, int as an optimization
- datum = int(bool(datum))
+ if datum is not _marker:
+ datum = int(bool(datum))
# We don't want to do anything that we don't have to here, so we'll
# check to see if the new and existing information is the same.
Modified: Products.ZCatalog/trunk/src/Products/PluginIndexes/BooleanIndex/tests.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/PluginIndexes/BooleanIndex/tests.py 2011-03-28 13:11:30 UTC (rev 121141)
+++ Products.ZCatalog/trunk/src/Products/PluginIndexes/BooleanIndex/tests.py 2011-03-28 13:15:43 UTC (rev 121142)
@@ -46,6 +46,13 @@
self.failUnless(1 in index._unindex)
self.failIf(1 in index._index)
+ def test_index_missing_attribute(self):
+ index = self._makeOne()
+ obj = Dummy(1, True)
+ index._index_object(obj.id, obj, attr='missing')
+ self.assertFalse(1 in index._unindex)
+ self.assertFalse(1 in index._index)
+
def test_search_true(self):
index = self._makeOne()
obj = Dummy(1, True)
More information about the checkins
mailing list