[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/common - UnIndex.py:1.8

Toby Dickenson tdickenson@geminidataloggers.com
Mon, 11 Mar 2002 08:16:32 -0500


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/common
In directory cvs.zope.org:/tmp/cvs-serv10762/lib/python/Products/PluginIndexes/common

Modified Files:
	UnIndex.py 
Log Message:
merged toby-subclass-index-branch: Collector 284: KeywordIndex and FieldIndex subclassing

=== Zope/lib/python/Products/PluginIndexes/common/UnIndex.py 1.7 => 1.8 ===
 
         # First we need to see if there's anything interesting to look at
-        # 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:
-            datum = getattr(obj, self.id)
-            if callable(datum):
-                datum = datum()
-        except AttributeError:
-            datum = _marker
- 
+        datum = self._get_object_datum(obj)
+
         # We don't want to do anything that we don't have to here, so we'll
         # check to see if the new and existing information is the same.
         oldDatum = self._unindex.get(documentId, _marker)
@@ -240,6 +232,18 @@
             returnStatus = 1
 
         return returnStatus
+
+    def _get_object_datum(self,obj):
+        # 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:
+            datum = getattr(obj, self.id)
+            if callable(datum):
+                datum = datum()
+        except AttributeError:
+            datum = _marker
+        return datum
 
     def numObjects(self):
         """ return number of indexed objects """