[Zope3-dev] Recursive containment constraints
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Sep 15 09:09:50 EDT 2004
On Wednesday 15 September 2004 09:01, Dominik Huber wrote:
> Month ago I read the contenttype part of stephan's book. at that time he
> used
> setTaggedValue to solve recursive containment constraints:
>
> 43 IMessage['__setitem__'].setTaggedValue('precondition',
> 44
> ItemTypePrecondition(IMessage))
> 45 IMessage.setTaggedValue('__parent__', Field(
> 46 constraint=ContainerTypesConstraint(IMessageBoard,
> IMessage)))
>
> Today I wanted to use the setTaggedValue('__parent__', Field(...))
> approach but it
> seems not work anymore. Is that right?
No, it should still work. I did not change to another pattern for technical
reasons.
> >>> '__parent__' in IMessage.names('all')
> False
>
> The new version of the book solves this problem with two indepentent
> interfaces IMessage
> and IMessageContained. Is that the 'official' pattern people should
> follow?
Yeah, I think this is the recommended pattern. I changed to this one, since it
is easier to read and understand. Also, all sample applications use this
pattern as well.
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-dev
mailing list