Re: [Zope3-Users] list woes

2006-06-15 Thread Marco Mariani
Bernd Dorn wrote: > you reassign the attribute here, so the list is never persistent I thought about that, it's python 101 after all > in Person.__init__ do: self.gadgets=PersistentList() > > and then in growup: > > person.gadgets.extend([ Gadget(toy) for toy in baby.toys ]) Yes, indeed, what I tr

Re: [Zope3-Users] list woes

2006-06-15 Thread Bernd Dorn
On 13.06.2006, at 00:16, Marco Mariani wrote: I'm having this stripped-down use case. class IToy(Interface): name = TextLine(title=u"Toy") class Toy(Persistent): name = FieldProperty(IToy['name']) class IGadget(Interface): name = TextLine(title=u"Gadget") class Gadget(Persist

Re: [Zope3-Users] list woes

2006-06-14 Thread Marco Mariani
On Wed, Jun 14, 2006 at 03:22:29PM -0500, mats.nordgren wrote: > 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. Oh, well, nice to know. > Instead of using FieldProperty, try to define it directl

Re: [Zope3-Users] list woes

2006-06-14 Thread mats.nordgren
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 = FieldPro

Re: [Zope3-Users] list woes

2006-06-14 Thread Marco Mariani
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 ___

Re: [Zope3-Users] list woes

2006-06-12 Thread Marco Mariani
Marco Mariani wrote: > class Gadget(Persistent): > name = FieldProperty(IGadget['name']) > > def __init__(self,toy): > super(Person, self).__init__(self) > Of course it's super(Gadget, self) This is not real code, I've simplified a lot _