[Zope3-Users] Two content objects' simultaneous adding

Jonathan dev101 at magma.ca
Sat May 20 09:35:53 EDT 2006


----- Original Message ----- 
From: "baiju m" <baiju.m.mail at gmail.com>
>I have two content objects (both are containers) but I cannot add one
> to another as give here :
>
>    def create(self, data):
>        square = Square()
>        square.name = data['name']
>        square.description = data['description']
>        company = Company()
>        company.name = data['companyname']
>        company.description = data['companydescription']
>        square['Comp1'] = company
>        ...
>        return square


I don't use zope 3 (yet!) but a quick look at the above code seems to 
indicate that this is not a zope 3 issue:

>        square = Square()
This line assigns an object to 'square'

>        square.name = data['name']
This line treats square properly

>        square['Comp1'] = company
This line treats square as if it were a python dictionary (not an object, 
which it is!)

I think you need Square() to create a dictionary item within the object it 
returns and then access the list item by:
        square.compList['Comp1'] = company


Just a guess...


Jonathan




More information about the Zope3-users mailing list