[Grok-dev] Re: zope.app.keyreference.interfaces.NotYet(object)
Philipp von Weitershausen
philipp at weitershausen.de
Sun Jul 15 16:59:17 EDT 2007
Sebastian Ware wrote:
> What surprised me was that that kind of assignment worked with my
> grok.Application object...
>
> class ProtonCMS(grok.Application, grok.Container):
> interface.implements(interfaces.IProtonCMS)
>
> def __init__(self):
> super(ProtonCMS, self).__init__()
> self.title = ''
> self.description = ''
> self['default'] = protonworkflow.ProtonWorkflow()
>
> ...and I was expecting the "class ProtonContainer(grok.Container,
> protonobject.ProtonObject)" to work in the same way.
>
> Do you know why I can make the assignment in the grok.Application object
> but not in the grok.Container object?
Yup. Because the catalog (which keeps the indexes for your objects) is
created whenever a grok.Application object is created. Actually, it's
creates slightly after the application object. That's why indexing won't
happen in any application's __init__ method. But it will happen upon all
other modified events, and container[name] = obj happens to throw a
ContainerModifiedEvent or something of that sort.
--
http://worldcookery.com -- Professional Zope documentation and training
More information about the Grok-dev
mailing list