Re: [Zope3-Users] proxied list object in a schema

2006-12-19 Thread Tim Terlegård
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 requires 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
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] proxied list object in a schema

2006-12-17 Thread FB
Hi,

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()
 
 class class=.chat.Chat
 require permission=zope.View interface=.interfaces.IChat /
 require permission=zope.View set_schema=.interfaces.IChat /
 /class

try that:

class MyList(persistent.list.PersistentList):
   pass

class class=.MyList
   ...
/class

You should find the necessary interfaces for your requires in
zope.interface.common.mapping.

Regards,

Frank
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users