[Zope3-Users] querying the catalog
Jim Fulton
jim at zope.com
Mon Oct 3 10:15:26 EDT 2005
Duncan McGreggor wrote:
>
> On Sep 30, 2005, at 11:31 PM, Alen Stanisic wrote:
>
>> Not sure if it will help but whenever I had to look up a catalog I would
>> only do zapi.getUtility(ICatalog) and I noticed you are also providing a
>> name and context.
>
>
> Yeah, with or without the extra parameters, it always only returns the
> root catalog instance.
>
>> I also believe that if you are looking up a catalog by name as you seem
>> to be doing it is not enought for the catalog object to be named
>> accumac_catalog but you also have to register it as the name ('Register
>> As' field in New Utility Registration) during catalog creation. I
>> usually leave 'Register As' blank as I only ever needed to get catalog
>> by ICatalog interface only -> zapi.getUtility(ICatalog)
>
>
> When I created it, I set "register as" to "accumac_catalog". Based on
> the experience you shared, I deleted my catalog and did not give it a
> name upon creation. zapi.getUtility(ICatalog) now works, as it gets the
> "sub-site's" catalog in the accumac/++etc++site/default directory.
>
> Very strange. If I understood this more, or if there was expert-aided
> interest, I would troubleshoot this. It may not be a bug, but there at
> least seem to be issues of an anti-intuitive nature here...
>
> Alen, thanks again for your assistance in this matter :-)
I suspect there was a problem of some sort with your original registration.
We normally use named local catalogs and haven't had a problem.
BTW, you should not pass the "context" argument to the component-lookup
functions *unless* you want to find a component in a different site.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-users
mailing list