[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py Brought forward from the Zope 2.7 branch:

Zachery Bir zbir at urbanape.com
Wed Aug 24 11:52:18 EDT 2005

Log message for revision 38062:
  Brought forward from the Zope 2.7 branch:
  If the new value is _marker (basically, if we index with a value of
  None), we should also remove the object from our _unindex

  U   Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py

Modified: Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
--- Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py	2005-08-24 15:51:38 UTC (rev 38061)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py	2005-08-24 15:52:18 UTC (rev 38062)
@@ -26,6 +26,8 @@
 from DateTime.DateTime import DateTime
 from Globals import DTMLFile
 from OFS.PropertyManager import PropertyManager
+from ZODB.POSException import ConflictError
+from zLOG import LOG, ERROR
 from zope.interface import implements
 from Products.PluginIndexes.common import safe_callable
@@ -135,6 +137,15 @@
         if ConvertedDate != oldConvertedDate:
             if oldConvertedDate is not _marker:
                 self.removeForwardIndexEntry(oldConvertedDate, documentId)
+                if ConvertedDate is _marker:
+                    try:
+                        del self._unindex[documentId]
+                    except ConflictError:
+                        raise
+                    except:
+                        LOG('UnIndex', ERROR,
+                            'Should not happen: oldDatum was there, now its not,'
+                            'for document with id %s' % documentId)
             if ConvertedDate is not _marker:
                 self.insertForwardIndexEntry( ConvertedDate, documentId )

More information about the Zope-Checkins mailing list