[Grok-dev] Containment with grok.Container
Christian Theune
ct at gocept.com
Fri Oct 20 04:25:26 EDT 2006
Mornin,
Philipp von Weitershausen wrote:
> 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?
Must be something, because the wiki app broke just by switching from the
Folder to the grok.Container. ;) (And no, I don't refer to inconsistent
ZODBs ...)
>> 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?
The order of 'class Model(Contained, Persistent)' is important if you
mix it in with Container, otherwise Python complains about the MRO.
>> 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.
I'm undecided on this too.
Christian
--
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20061020/d6699fe9/signature.bin
More information about the Grok-dev
mailing list