[Zope3-Users] Problems with a catalog

Tom Dossis td at yoma.com.au
Tue Sep 27 22:01:56 EDT 2005


1. How do I add a catalog to a site ?
2. Catalog error

1/---------------------------------------------------------

I get thus far..

 From the /++etc++site/@@SiteManagement form I can successfully add a 
Catalog object.  However, when I try to add an index, it fails ...

   File "... /zope/app/catalog/catalog.py", line 130, in indexAdded
   File "... /zope/app/catalog/catalog.py", line 68, in updateIndex
   File "... /zope/component/__init__.py", line 257, in getUtility
ComponentLookupError: (<InterfaceClass 
zope.app.intid.interfaces.IIntIds>, '')


Then if I try to add an IntId Tool, it fails  ...

   File "... app/catalog/catalog.py", line 144, in reindexDocSubscriber
   File "... component/__init__.py", line 257, in getUtility
ComponentLookupError: (<InterfaceClass 
zope.app.intid.interfaces.IIntIds>, '')

Actually, attempting to add any other object no longer works with the 
same error. So the catalog depends on a/the intid utilitly.


When I add a uid utility first, then a catalog, adding and index still 
fails (as above).

2/--------------------------------------------------------------------

However, if I add the IntId utility to /++etc++/default (rather than 
/++etc++/tools), I can add a catalog, then successfully create index(es).

However when I try to search the catalog it fails..

 >>> cat = zapi.getUtility(ICatalog, context=root)
 >>> print cat.searchResults()
None
 >>> print cat.searchResults(title_index='')
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "... /zope/app/catalog/catalog.py", line 107, in searchResults
   File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 257, in 
getUtility
zope.component.interfaces.ComponentLookupError: (<InterfaceClass 
zope.app.intid.interfaces.IIntIds>, '')


(Don't know why PIL is appearing in the traceback.)

I can make it work if I change (catalog.py:107)

from: uidutil = zapi.getUtility(IIntIds)
to:   uidutil = zapi.getUtility(IIntIds, context=self)

 >>> cat = zapi.getUtility(ICatalog, context=root)
 >>> cat.searchResults(title_index='')
<zope.app.catalog.catalog.ResultSet instance at 0x41ac168c>


I don't know why the context needs to be explicitly set.  Is it 
something to do with how the IntIds/Calatogs should be added to the site?





More information about the Zope3-users mailing list