[Grok-dev] Containment with grok.Container

Martijn Faassen faassen at infrae.com
Fri Oct 20 04:13:43 EDT 2006


Christian Theune wrote:
> grok.Container (which derives from
> zope.app.container.btree.BTreeContainer) does something different than
> zope.app.folder.Folder.
> 
> 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. :/

I think that this is because if you don't, Zope 3 will put on magic 
proxy wrappers that try to fake this behavior, but it is too magic so 
not very comprehensible. I think subclassing Contained on model is fine.

> 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.
> 
> 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.

I think Folder probably contains the magic proxy wrapper behavior then. 
Why don't we just derive from zope.app.folder.Folder though?

Regards,

Martijn


More information about the Grok-dev mailing list