[Zope3-Users] Re: register and unregister Utility

Florian Lindner mailinglists at xgm.de
Sat Dec 30 13:26:07 EST 2006


Am Mittwoch, 27. Dezember 2006 21:42 schrieb Jürgen Kartnaller:
> Florian Lindner wrote:
> > Am Mittwoch, 27. Dezember 2006 19:15 schrieb Jürgen Kartnaller:
> >> component.provideUtility for a global utility.
> >
> > I've found that.
> >
> >> See zope.component.interfaces.IComponentRegistrationConvenience
> >
> > Ok, for registering. But what to call for unregistering? (I have a global
> > utility)
>
> zope.component.getGlobalRegistry() implements IComponentRegistry
>
> >> Or for local utilities registered in a site manager you use the site
> >> manager :
> >>
> >> sm.registerUtility
> >> sm.unregisterUtility
> >>
> >> See zope.component.interfaces.IComponentRegistry
> >
> > Ok, there is the unregisterUtility function. Where do I get an object
> > implementing this interface?

I have done it this way now:

from zope import component
components = component.registry.Components()
components.registerUtility(self, INewsfeed, self.__name__)

(example from registry.txt from apidoc)

It works so far that no error is raised. But I wonder why the object is not 
shown as registered in the ZMI?

Thanks,

Florian


More information about the Zope3-users mailing list