[Checkins] SVN: Zope/branches/andig-compositeindex/src/Products/ZCatalog/Catalog.py uniqueValuesFor check by IUniqueValueIndex.providedBy

Andreas Gabriel gabriel at hrz.uni-marburg.de
Tue Oct 5 18:44:36 EDT 2010


Log message for revision 117256:
  uniqueValuesFor check by IUniqueValueIndex.providedBy
  

Changed:
  U   Zope/branches/andig-compositeindex/src/Products/ZCatalog/Catalog.py

-=-
Modified: Zope/branches/andig-compositeindex/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/branches/andig-compositeindex/src/Products/ZCatalog/Catalog.py	2010-10-05 18:24:36 UTC (rev 117255)
+++ Zope/branches/andig-compositeindex/src/Products/ZCatalog/Catalog.py	2010-10-05 22:44:35 UTC (rev 117256)
@@ -24,6 +24,7 @@
 from Missing import MV
 from Persistence import Persistent
 from Products.PluginIndexes.interfaces import ILimitedResultIndex
+from Products.PluginIndexes.interfaces import IUniqueValueIndex
 from Products.PluginIndexes.interfaces import ITransposeQuery
 
 import BTrees.Length
@@ -395,11 +396,17 @@
                       'attempted to uncatalog an object '
                       'with a uid of %s. ' % str(uid))
 
-
     def uniqueValuesFor(self, name):
         """ return unique values for FieldIndex name """
-        return self.getIndex(name).uniqueValues()
 
+        indexes = self.indexes.keys()
+        for idx in indexes:
+            x = self.getIndex(idx)
+            if IUniqueValueIndex.providedBy(x) and x.hasUniqueValuesFor(name):
+                return x.uniqueValues(name=name)
+
+        return []
+
     def hasuid(self, uid):
         """ return the rid if catalog contains an object with uid """
         return self.uids.get(uid)



More information about the checkins mailing list