[Zope3-Users] querying the catalog

Alen Stanisic alen.stanisic at gmail.com
Sat Oct 1 01:31:39 EDT 2005


I think I understand now, you have a page view index.html with view
class HomePageView which looks up a catalog but when you go to the page:

/accumac/index.html

the local catalog

/accumac/++etc++site/default/accumac_catalog

is not being found, but a catalog in the root site is returned.

Unfortunately not sure why this would be happening, I would definitely
expect the local catalog to be returned first.  

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.  Maybe you need to do this as you have more than one
catalog in your ++etc++site.  I think another thing to make sure is that
your local catalog provides ICatalog interface.  

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)

Alen

On Fri, 2005-09-30 at 19:25 -0600, Duncan McGreggor wrote:
> On Sep 30, 2005, at 7:17 PM, Alen Stanisic wrote:
> 
> > My understanding was that your zapi.getUtility() was not finding your
> > catalog and that you had three parallel sites from which you were doing
> > the catalog look up and the catalog was only in one of them, accumac
> > site:
> >
> > /accumac/++etc++site/default/accumac_catalog
> >
> > I guess the success of the catalog look up depends on what your 
> > self.context is when you are
> > doing zapi.getUtility(), i.e. where you are looking up the catalog 
> > from.  I would expect
> > your code to find the catalog when self.context is inside accumac 
> > site, but would not
> > expect the catalog to be found from inside the other two sites.
> 
> Okay, that's what I thought you were talking about. So, to clarify, I 
> am not interesting in finding any content outside of the subs-sites; 
> they are little units in and of themselves, and content searches take 
> place only within the context of a subsite. The problem is (using a 
> specific example) that the catalog in the subsite "accumac" is not 
> being found. That's the one I want found, and only within the context 
> of the accumac site itself. It *is* finding a catalog, though not the 
> one I want. The one it is finding is at /++etc++site/default (and not 
> /accumac/++etc++site/default).
> 
> Thanks for taking the time to understand :-)
> 
> d
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users



More information about the Zope3-users mailing list