[Grok-dev] Containment with grok.Container

Philipp von Weitershausen philipp at weitershausen.de
Thu Oct 19 17:48:33 EDT 2006


Christian Theune wrote:
> grok.Container (which derives from
> zope.app.container.btree.BTreeContainer) does something different than
> zope.app.folder.Folder.

Does it? What is it?

> For some reason I had to make the model implement IContained (by
> subclassing contained.Contained in this case) to get the __parent__
> attribute set correctly. :/

Yes, IContained is a way to indicate "please set __parent__ and __name__ 
directly on me". Otherwise you'll get a ContainedProxy around the object.

> This introduced a delicately balanced equilibrium between grok.Model and
> grok.Container that I'm unhappy with because it depends on the order of
> the base classes of grok.Model to be able to mix-in models and containers.

Huh?

> We could argue that grok.Container always is a model and should not be
> mixed in, or we could try harder to figure out what the BTreeContainer
> does different that the dependency on Contained is needed.

Making grok.Container a Model wouldn't be a problem, but perhaps it's 
not a necessity either.

Philipp


More information about the Grok-dev mailing list