[Zope3-Users] automatically adding content container

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jun 3 15:14:38 EDT 2005


On Tuesday 24 May 2005 04:57, Alen Stanisic wrote:
> # create container
> sample_obj = zapi.createObject(None, u"MyTestItemContainer")
> self.context.__parent__['SampleContainer'] = sample_obj
> # get content object
> sample_item_obj = zapi.createObject(None, u"MyTestItem")
> # data obtained from IMyTestItem add form using getWidgetsData
> sample_item_obj.surname = data['surname']
> sample_item_obj.firstName = data['firstName']
> # place sample_item_obj in the container object
> self.context.__parent__['SampleContainer']['SamplePerson'] =
> sample_item_obj

That's pretty much it. Except:

obj.__parent__ ==> zapi.getParent(obj)

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list