[Zope-Coders] ZCTextIndex too sensitive

Sidnei da Silva sidnei@x3ng.com
Thu, 12 Jun 2003 13:53:58 -0300


Howdy folks,

Im trying to finish NZO alpha, and Im having lots of trouble with
ZCTextIndex being too sensitive to errors. Heres what's happening:

- Im using QueueCatalog, so, indexing is being delayed. Thats fine.
- Ive run migration to completion, which is also fine.
- Now I have 110K objects on the queue, that wont finish indexing
  because of an exception in the mid of processing the queue. The
  exception follows:

 (Object: portal_catalog)
    (Info:
    ('/Members/jacques.adamski/RexxDocument/RexxDocument-1.0.2.tgz',
    (2, 3)))
  File /home/zope/alpha2/var/zope/Products/CMFCore/CatalogTool.py,
  line 232, in catalog_object
    (Object: portal_catalog)
  File
  /home/zope/alpha2/opt/Zope-2.6-branch/lib/python/Products/ZCatalog/ZCatalog.py, line 500, in catalog_object
    (Object: portal_catalog)
  File
  /home/zope/alpha2/opt/Zope-2.6-branch/lib/python/Products/ZCatalog/Catalog.py, line 363, in catalogObject
  File
  /home/zope/alpha2/opt/Zope-2.6-branch/lib/python/Products/ZCTextIndex/ZCTextIndex.py, line 157, in index_object
    (Object: Description)
AttributeError: __call__

Line 157 of ZCTextIndex is: 

----------------------------------------------------------------------
        if callable(text):
            text = text()
----------------------------------------------------------------------

So, how come 'text' is callable but doesnt have __call__? Weird. I
think there is some code on other indexes that deal with this, but I
havent looked around yet (a grep for safe_callable may do it). Looking
at the PluggableIndexes/TextIndex/TextIndex.py, I can see that it does
a more safer (from my pov) approach, which is putting a try/except
around the call and catching AttributeError and KeyError.

Now my question: How do we fix this? 

 a. Putting a try/except
 b. Using 'safe_callable'
 c. ???

PS: May I merge my other patch to KeywordIndexes with the
modifications suggested by Casey[1]?

[1] http://mail.zope.org/pipermail/zope-coders/2003-May/003711.html
-- 
Sidnei da Silva (dreamcatcher) <sidnei@x3ng.com.br>
X3ng Web Technology <http://www.x3ng.com.br>
GNU/Linux user 257852
Debian GNU/Linux 3.0 (Sid) 2.4.20-powerpc ppc

Any sufficiently advanced bug is indistinguishable from a feature.
		-- Rich Kulawiec