[Zope3-Users] proxied list object in a schema

Tim Terlegård tim at se.linux.org
Tue Dec 19 03:25:20 EST 2006


On Sun, Dec 17, 2006 at 09:57:08PM +0100, FB wrote:
> On Sun, Dec 17, 2006 at 02:21:03PM +0100, Tim Terlegård wrote:
> > Would someone like to explain how to use a list in a schema object
> > without getting ForbiddenAttribute? This is my use case.
> > 
> > class IChat(Interface):
> >     messages = Attribute('Chat messages')
> > 
> > class Chat(Persistent):
> >     def __init__(self):
> >         self.messages = persistent.list.PersistentList()
> 
> try that:
> 
> class MyList(persistent.list.PersistentList):
>    pass
> 
> <class class=".MyList">
>    ...
> </class>
> 
> You should find the necessary interfaces for your <require>s in
> zope.interface.common.mapping.

This worked very well. I used ISequence from
zope.interface.common.sequence. The good part is that I now understand
why it should be done this way. Thanks.

Tim


More information about the Zope3-users mailing list