[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndex - TextIndex.py:1.34.6.1

Sidnei da Silva sidnei@x3ng.com.br
Tue, 17 Jun 2003 14:14:58 -0400


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

Modified Files:
      Tag: Zope-2_6-branch
	TextIndex.py 
Log Message:
 - Made all PluginIndexes and ZCTextIndex use 'safe_callable',
        which is aware of extension classes that fill 'tp_callable'
        but don't define '__call__'.

      - Made KeywordIndex be more robust about receiving a value that
        is not a string or an iterable type.

=== Zope/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py 1.34 => 1.34.6.1 ===
--- Zope/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py:1.34	Wed Aug 14 18:19:32 2002
+++ Zope/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py	Tue Jun 17 14:14:27 2003
@@ -31,6 +31,7 @@
 from BTrees.OIBTree import OIBTree
 from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet
 from BTrees.IIBTree import difference, weightedIntersection
+from Products.PluginIndexes.common import safe_callable
 
 from Lexicon import Lexicon
 
@@ -282,7 +283,7 @@
         # index is this attribute.  If it smells callable, call it.
         try:
             source = getattr(obj, self.id)
-            if callable(source):
+            if safe_callable(source):
                 source = source()
 
             if not isinstance(source, UnicodeType):
@@ -295,7 +296,7 @@
 
         try:
             encoding = getattr(obj, self.id+'_encoding')
-            if callable(encoding ):
+            if safe_callable(encoding ):
                 encoding = str(encoding())
             else:
                 encoding = str(encoding)