[Zope3-dev] registration of local utilities through-the-web
Jean-Marc Orliaguet
jmo at ita.chalmers.se
Wed May 3 10:44:40 EDT 2006
Jean-Marc Orliaguet wrote:
>
> Hi!
>
> I think I've identified an issue with the TTW local utilities
> registration (svn trunk), I'm not sure how this is solved (it could be
> a bug):
>
> I have a folder that acts as a persistent components registry:
>
> class SomeFolder(..., PersistentComponents)
> implements(ISomeFolder)
>
> which means that it can hold information about locally registered
> utilities, adapters, ...
>
> The problem is that when I register a SomeFolder as a local utility,
> instead of getting registered in the site manager "above", it gets
> registered "in itself", so basically it never gets registered in the
> application.
>
> to reproduce the issue simply subclass PersistentComponents, and do a
> PersistentComponents.__init__(...) on an existing component (.e.g
> HelloWorld); you will be able to register it as a local utility but it
> won't appear in the site manager's registrations.
>
> Any idea?
>
> regards
> /JM
>
well, the bug is here:
zope/app/component/browser/registration.py
@form.action(_("Register"))
def register(self, action, data):
sm = component.getSiteManager(self.context)
in that case 'sm' and 'context' are the same.
I've filed a bug at:
http://www.zope.org/Collectors/Zope3-dev/597
a solution would be to get the site manager on the parent folder, eg.
if sm == context:
sm = component.getSiteManager(getParent(context))
...
/JM
More information about the Zope3-dev
mailing list