[Zope3-dev] Re: Constraining where objects can be added
Philipp von Weitershausen
philipp at weitershausen.de
Mon Jun 7 05:28:11 EDT 2004
Stephan Richter wrote:
> On Sunday 06 June 2004 06:00, Philipp von Weitershausen wrote:
>
>>Michał Węgrzynek wrote:
>>u
>>>IArtist.__parent__ = zs.Field(constraint = \
>>> zcc.ContainerTypesConstraint(IArtistsContainer))
>>
>>This will not work. Interfaces are not classes and they don't expose
>>their fields and method definitions through the getattr protocol, but
>>the getitem protocol. Alas, they don't support the setitem protocol, so
>>there's no good way to dynamically change an interface like.
>
> See the first chapter of the Content Component part in the Zope 3 book.
Yes, I see you are using setTaggedValue. I think that's a big
indirection and frankly quite ugly. I would always prefer a separate
interface, as shown in the buddy demo. I would also think that it is
easier to understand for newbies, unless you explained how interfaces
internals (like tagged values) work.
Philipp
More information about the Zope3-dev
mailing list