On Oct 3, 2005, at 8:11 AM, Gary Poster wrote:

Hi Duncan. I tried following up on some of the later replies, but I think it's easier to reply to your first email.

I think that what is tripping you up is the idea of registration names versus container names.

You can put a utility in any site package, and call it whatever you want. This will not register it at all, let alone for any given name.

What you need to do next is to actually register the utility with the placeful (i.e., local to a site in the ZODB, not global in memory) site manager, so the component architecture will find it. When you register it, you provide another name, unrelated to the first, that is the *registration* name.

For instance, if I create a catalog in a site manager in the default package, I might call it 'site_catalog'). After creation, so far the only way I can address it is by walking to it through the ZODB (say, with the container API, or with traversal as you found). I next need to register this catalog to perform the role of ICatalog in the site. I can provide a name or not, for this registration; whatever name I use is the name that will be used for lookup with a getUtility or queryUtility call.

See http://mail.zope.org/pipermail/zope3-users/2005-September/001078.html for my attempt at detailed instructions.

On Oct 3, 2005, at 8:15 AM, Jim Fulton wrote:

Duncan McGreggor wrote:

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.

Gary and Jim, thank you both for your feedback. After playing with the catalogs some more, and based on the information that Gary provided I am sure you are correct, Jim. And thanks for the tip on the contect!


Zope3-users mailing list

Reply via email to