[ZPatterns] ZCatalog gotcha: indexes cause calling of eponymous Specialists

Jean Jordaan jean@upfrontsystems.co.za
Tue, 4 Dec 2001 12:01:12 +0200


Hi there

I suspect this gotcha might have to do with how ZPatterns
is implemented. Here's what happens: when trying to catalog
anything in my Products specialist, Zope would raise a 
SiteError (AttributeError: __call__) in line 116 of 
.../lib/python/SearchIndex/UnKeywordIndex.py
This is 'newKeywords = newKeywords()' in the following::

        if callable(newKeywords):
            newKeywords = newKeywords()

At the point where the SiteError was being raised, the value
of newKeywords is::

 (Pdb) newKeywords
 <Specialist instance at 8b8aa60>
 (Pdb) newKeywords.id
 'Components'
 (Pdb) n
 AttributeError: '__call__'

It seems that it got that value because I had indexes on
DataSkin properties 'Components' and 'Modules'. Now Zope is
getting hold of the Specialists named 'Components' and 
'Modules', instead of the properties. And the Specialists
are passing the 'if callable(newKeywords):' check, so Python
thinks they are callable, and then Zope barfs on the next
line. 

Is my thinking correct, or am I way off track?

Regards,
Jean Jordaan