[Zope] local and global site manager, adapter and utility questions

Thierry Florac thierry.florac at onf.fr
Tue May 14 07:22:58 UTC 2013


Le Tue, 14 May 2013 06:55:38 +0200,
  Tamer Higazi <th982a at googlemail.com> a écrit:

> 1. What is the difference between a global and a localSiteManager from
> the zope.component package?!
> How do I have to understand that a "globalSiteManager" resists in
> memory, and a localSiteManager is persistent ?!
> Could somebody of you explain it to me?!

Yes, there are two kinds of complementary "registries" (or "site
 - a global one, mainly build by ZCML (or "static") declarations
 - a local one, which is made of persistent components registered into
   the ZODB. Local components are "contextual", so are only available
   (by default) to objects "attached" to the site manager inside which
   these components are defined. This registry is mainly specific to
   Zope applications so if you build a ZCA-based application outside of
   Zope, you will probably don't have a local registry.

Where you are looking for a component, search is made at first in the
local registry, then in the global one.

> 2. What is the difference between an adapter and a utility ?! I
> register an adapter as well the same way as I do with a utility, and
> I query those 2 as well. But what's the point there?!

A utility is a simple named component which provides an interface;
it's generally a singleton.
An adapter, on the opposite, takes one or more objects arguments (each
providing a given interface) to return an object providing another


P.S.: please avoid cross-posts!

More information about the Zope mailing list