[Zope3-Users] list woes

mats.nordgren mats at ronin-group.org
Wed Jun 14 16:22:29 EDT 2006


I'm not sure this is it or not but FieldProperty doesn't play nice with the
persistent list and dict, it will only accept the non persistent list.

>>> class ITest(Interface):
...     mylist = List(title=u'My List')
...
>>> class Test(Persistent):
...     implements(ITest)
...     mylist = FieldProperty(ITest['mylist'])
...
>>> test = Test()
>>> test.mylist = PersistentList()
...
WrongType: ([], <type 'list'>)
>>> test.mylist = list()
>>> test.mylist
[]

Instead of using FieldProperty, try to define it directly as a PersistentList
and see if that solves the problem.

Cheers,

Mats

On Wed, 14 Jun 2006 20:16:57 +0200, Marco Mariani wrote
> Marco Mariani wrote:
> > This creates the gadgets (one per each toy) but the Gadget.name
> > attributes, altough being created, are not persisted.
> >   
> I'd like to understand if what I was trying to do with my objects should
> "just work", or if I misunderstood something.
> 
> tnx
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users



More information about the Zope3-users mailing list