[BlueBream] local and global site manager, adapter and utility ?!
Войнаровський Тарас
voyn1991 at gmail.com
Tue May 14 07:29:02 UTC 2013
Hi Tamer.
2013/5/14 Tamer Higazi <th982a at googlemail.com>
> 1. What is the difference between a global and a localSiteManager from
> the zope.component package?! How does it How do I have to understand
> that a "globalSiteManager" is in memory, and a localSiteManager is
> persistent ?!
>
"SiteManager" is a deprecated term and now is replaced by "registry". A
registry can perform registrations of adapters and utilities (components in
short). Look at the interface in zope.interface.interfaces.IComponents and
you will see a standard registry interface (earlier this interface was in
zope.component but as of zope.interface-3.8 it migrated). SiteManager is an
implementation of this interface.
*Zope has a* *more complex lookup process* for components. It can provide
several registries. They are known as SiteManagers.
If you just start a python process and import the zope.component package it
will have 1 registry in memory (the globalSiteManager or global registry).
When you issue a getAdapter call it will find that registry and ask it for
the adapter.
The localSiteManager is a *hooked* registry (it is persistent by default in
BlueBream within the ZODB). If it is present the upper adapter lookup
process will *ask the local registry for an adapter and only if it does not
provide it will it ask the global one*.
In bluebream you can provide several localSiteManagers in witch case the
lookup will be processed through all of them up to the global one.
2013/5/14 Tamer Higazi <th982a at googlemail.com>
>
> 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?!
>
Both are based on the same adapters registries, but the have different
concept and usage.
*Adapter* is a wrap around some object to provide some specific interface.
So basicly adapting means getting a specific interface for managing *one or
many objects*.
*Utility* is an object that provides the interface and does not wrap
anything. When you lookup utilities, you *do not provide any objects* that
will be managed by it.
Hope this helps.
Taras
2013/5/14 Tamer Higazi <th982a at googlemail.com>
> Hi people!
> I have worked out so far the ZCA tutorial, and there are certain things
> for me not clear.
>
> 1. What is the difference between a global and a localSiteManager from
> the zope.component package?! How does it How do I have to understand
> that a "globalSiteManager" is in memory, and a localSiteManager is
> persistent ?!
>
> Could somebody of you explain it to me?!
>
>
> 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?!
>
>
>
> For answering my questions, I would kindly thank you.
>
>
>
>
> Tamer
> _______________________________________________
> bluebream mailing list
> bluebream at zope.org
> https://mail.zope.org/mailman/listinfo/bluebream
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/bluebream/attachments/20130514/2d4a644c/attachment.html>
More information about the bluebream
mailing list