[Zope-Checkins] CVS: Zope2 - UnKeywordIndex.py:1.12.2.2.4.6

chrism@serenade.digicool.com chrism@serenade.digicool.com
Sat, 10 Mar 2001 13:34:37 -0500


Update of /cvs-repository/Zope2/lib/python/SearchIndex
In directory serenade:/slab/home/chrism/sandboxes/CatalogBTreesIntegration/lib/python/SearchIndex

Modified Files:
      Tag: Catalog-BTrees-Integration
	UnKeywordIndex.py 
Log Message:
Fixed index_object when unindexing elements of a keyword list. 


--- Updated File UnKeywordIndex.py in package Zope2 --
--- UnKeywordIndex.py	2001/03/10 06:46:58	1.12.2.2.4.5
+++ UnKeywordIndex.py	2001/03/10 18:34:36	1.12.2.2.4.6
@@ -111,12 +111,9 @@
         # self.id is the name of the index, which is also the name of the
         # attribute we're interested in.  If the attribute is callable,
         # we'll do so.
-        try:
-            newKeywords = getattr(obj, self.id)
-            if callable(newKeywords):
-                newKeywords = newKeywords()
-        except AttributeError:
-            newKeywords = None
+        newKeywords = getattr(obj, self.id, None)
+        if callable(newKeywords):
+            newKeywords = newKeywords()
 
         if type(newKeywords) is StringType:
             newKeywords = (newKeywords, )
@@ -138,8 +135,8 @@
         else:
             if type(oldKeywords) is not OOSet: oldKeywords=OOSet(oldKeywords)
             newKeywords=OOSet(newKeywords)
-            
-            self.unindex_objectKeywords(difference(oldKeywords, newKeywords))
+            self.unindex_objectKeywords(
+                documentId, difference(oldKeywords, newKeywords))
             for kw in difference(newKeywords, oldKeywords):
                 self.insertForwardIndexEntry(kw, documentId)