[Checkins] SVN: Products.ZCatalog/trunk/ Prevent the new UUIDIndex from acquiring attributes via Acquisition.

Hanno Schlichting hannosch at hannosch.eu
Thu Apr 21 15:40:12 EDT 2011


Log message for revision 121462:
  Prevent the new UUIDIndex from acquiring attributes via Acquisition.
  

Changed:
  U   Products.ZCatalog/trunk/CHANGES.txt
  U   Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py

-=-
Modified: Products.ZCatalog/trunk/CHANGES.txt
===================================================================
--- Products.ZCatalog/trunk/CHANGES.txt	2011-04-21 19:35:24 UTC (rev 121461)
+++ Products.ZCatalog/trunk/CHANGES.txt	2011-04-21 19:40:12 UTC (rev 121462)
@@ -4,6 +4,7 @@
 2.13.11 (unreleased)
 --------------------
 
+- Prevent the new UUIDIndex from acquiring attributes via Acquisition.
 
 2.13.10 (2011-04-21)
 --------------------

Modified: Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py	2011-04-21 19:35:24 UTC (rev 121461)
+++ Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py	2011-04-21 19:40:12 UTC (rev 121462)
@@ -13,14 +13,15 @@
 
 from logging import getLogger
 
+from Acquisition import aq_base
 from App.special_dtml import DTMLFile
 from BTrees.IOBTree import IOBTree
 from BTrees.Length import Length
 from BTrees.OIBTree import OIBTree
 
+from Products.PluginIndexes.common.UnIndex import _marker
 from Products.PluginIndexes.common.UnIndex import UnIndex
 
-_marker = []
 logger = getLogger('Products.ZCatalog')
 
 
@@ -99,6 +100,15 @@
             del self._index[entry]
             self._length.change(-1)
 
+    def _get_object_datum(self, obj, attr):
+        # for a uuid it never makes sense to acquire a parent value via
+        # Acquisition
+        has_attr = getattr(aq_base(obj), attr, _marker)
+        if has_attr is _marker:
+            return _marker
+        return super(UUIDIndex, self)._get_object_datum(obj, attr)
+
+
 manage_addUUIDIndexForm = DTMLFile('dtml/addUUIDIndex', globals())
 
 



More information about the checkins mailing list