Re: howto add subobject during objectcreation
Joachim Schmitz <[email protected]>
| Newsgroups | gmane.comp.web.zope.cps.devel |
|---|---|
| Message-ID | <[email protected]> |
damien.metzler-Z/[email protected] schrieb: > When you retrieve your dep object, you get a proxy on the object. If you > want the real object, you must call the getContent method on the proxy. > > Try this : > < dep = getattr(container, id) >> dep = getattr(container, id).getContent() I did the objects are still created in the proxy for dep. now it is: def addDepartment(container, id, REQUEST=None, **kw): """Add a Department.""" object = Department(id, **kw) id = object.getId() container._setObject(id, object) dep = getattr(container,id).getContent() dep.invokeFactory('CoursesFolder','Courses') o = getattr(dep,'Courses') dict = {'Title': 'Courses'} o.getContent().edit(mapping=dict) dep.invokeFactory('CertificatesFolder','Certificates') o = getattr(dep,'Certificates') dict = {'Title': 'Certificates'} o.getContent().edit(mapping=dict) if REQUEST is not None: url = container.absolute_url() REQUEST.RESPONSE.redirect('%s/manage_main' % url) -- Mit freundlichen Grüßen Joachim Schmitz ...................................................................... AixtraWare eK ..Joachim Schmitz ..www.aixtraware.de ..t: +49-2464-8851 Hüsgenstr. 33a .....d-52457 Aldenhoven .............f: +49-2464-905163 _______________________________________________ cps-devel mailing list http://lists.nuxeo.com/mailman/listinfo/cps-devel