[Zope3-Users] Two content objects' simultaneous adding
Tom Dossis
td at yoma.com.au
Mon May 22 20:11:35 EDT 2006
Ron Bickers wrote:
> On Sat May 20 2006 17:09, Ron Bickers wrote:
>
>>> 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 did this very thing a couple days ago in 3.3 and it works for me, except
>> that I'm using zope.app.zapi.createObject to create the instances of my
>> content objects.
>
> Ok. So now I'm wondering... what's the point in using createObject if I can
> just create an object the Python way?
I guess createObject could be useful in an example such as a generic
add-objects menu. In this scenario it's probably be easier to deal with
factory names.
Otherwise I can't see why you shouldn't do it the python way if it's
more direct/explicit.
More information about the Zope3-users
mailing list