[Zope3-Users] Questions about utility/service registration

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jan 28 08:44:13 EST 2005


On Friday 28 January 2005 04:11, Sven Schomaker wrote:
> I've got a question about the registration of local services/utilities
> at the
> SiteManagementFolder. The registration of services (e.g.) seems to be
> performed in the following manner:
>
> sm_folder = zapi.traverse(folder.getSiteManager(), "default")
> sm_folder['Utilities'] = LocalUtilityService()
> rm = sm_folder.getRegistrationManager()
> key =
> rm.addRegistration(ServiceRegistration(zapi.servicenames.Utilities,
> sm_folder['Utilities'], rm))
> zapi.traverse(rm, key).status = ActiveStatus

Note that you should not write your own services. Also, in Zope 3.1 all this 
will go away. You might want to look and use the srichter-blow-services 
branch (http://svn.zope.org/Zope3/branches/srichter-blow-services/) to see 
how registration got simplified. Look in zope.app.component. There are many 
documentation files documenting the new API.

> Now as I figured out from the registration package, there may
> registration
> multiple components under a given name which is handled by means of a
> registration stack.

Right, but this will be deprecated, so don't use it.

> Now that I add one component to the sm_folder and register it at the
> registration manager how would one register another version of that
> component, since the sm_folder will only accept one item for a given
> name and reassignment will raise a DuplicateError.

It is complicated. ;-)

> Would one only register the new version of the component at the rm
> without assigning it to the sm_folder.

Well, in the SM the components need to have different names, but in the 
registration manager they can be both in the same stack. Note however, that 
only one component at a time can be *active* in the stack. This was 
originally implemented to support TTW package distribution.

> I wonder how the SiteManagementFolder and the registration stack are
> actually related and why one must both add the component to the
> SitemanagementFolder and to the RegistrationManager. So far I'm a bit
> stuck about this issue and would appreciate some help.

They are not related.

Anyways, don't go down this route, since it will not be there for long,

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list