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

Sidnei da Silva sidnei@x3ng.com.br
Tue, 17 Jun 2003 15:01:38 -0400


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

Modified Files:
	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.35 => 1.36 ===
--- Zope/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py:1.35	Thu Jan 23 12:46:28 2003
+++ Zope/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py	Tue Jun 17 15:01:07 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)