[Checkins] SVN: Products.ZCatalog/trunk/ Log an error message instead of raising a ValueError for value conflicts

Hanno Schlichting hannosch at hannosch.eu
Fri Jan 28 17:40:08 EST 2011


Log message for revision 119994:
  Log an error message instead of raising a ValueError for value conflicts
  

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-01-28 22:24:46 UTC (rev 119993)
+++ Products.ZCatalog/trunk/CHANGES.txt	2011-01-28 22:40:08 UTC (rev 119994)
@@ -6,9 +6,9 @@
 
 - Added a new UUIDIndex, based on the common UnIndex. It behaves like a
   FieldIndex, but can only store one document id per value, so there's a 1:1
-  mapping from value to document id. A ValueError is raised if a different
-  document id is indexed for an already taken value. The internal data
-  structures are optimized for this and avoid storing one IITreeSet per value.
+  mapping from value to document id. An error is logged if a different document
+  id is indexed for an already taken value. The internal data structures are
+  optimized for this and avoid storing one IITreeSet per value.
 
 - Optimize sorting in presence of batching arguments. If a batch from the end
   of the result set is requested, we internally reverse the sorting order and

Modified: Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py	2011-01-28 22:24:46 UTC (rev 119993)
+++ Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py	2011-01-28 22:40:08 UTC (rev 119994)
@@ -11,6 +11,8 @@
 #
 ##############################################################################
 
+from logging import getLogger
+
 from App.special_dtml import DTMLFile
 from BTrees.IOBTree import IOBTree
 from BTrees.Length import Length
@@ -19,6 +21,7 @@
 from Products.PluginIndexes.common.UnIndex import UnIndex
 
 _marker = []
+logger = getLogger('Products.ZCatalog')
 
 
 class UUIDIndex(UnIndex):
@@ -84,7 +87,7 @@
             self._index[entry] = documentId
             self._length.change(1)
         elif old_docid != documentId:
-            raise ValueError("A different document with value '%s' already "
+            logger.exception("A different document with value '%s' already "
                 "exists in the index.'")
 
     def removeForwardIndexEntry(self, entry, documentId):



More information about the checkins mailing list