Nuxeo mailing list archives
[CPS-devel] howto add subobject during objectcreation
Joachim Schmitz
js at aixtraware.de
Fri Jul 14 10:38:11 CEST 2006
Hi Julien,
Julien Anguenot schrieb:
> Hi Joachim,
>
> Joachim Schmitz wrote:
>> during the creation of a Department I want to add two Subfolders. The
>> addMehtod for my Department_Class looks like this:
>>
>> 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)
>> 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)
>>
>> the method runs through without errors. The Department is created fine,
>> but the subobjects "Courses" and "Certificates" are created in the proxy
>> of the created Department.
>>
>> Any hint is welcome.
>
> You can take advantage of the "created" alias defined on every
> CPSDocument content type. It will allow you to add the sub-objects
> creation from there. (check the alias tab on your content type in
> portal_types)
>
I don't find a "created" alias in portal_types Document.
--
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
More information about the cps-devel
mailing list
This list archive provided by Nuxeo, the
leaders of open source ECM.
Check out the Nuxeo 5 open source,
standards-based ECM project.