Re: howto add subobject during objectcreation

Julien Anguenot <[email protected]>
Newsgroups gmane.comp.web.zope.cps.devel
Organization NUXEO
Message-ID <[email protected]>
Joachim Schmitz wrote:
> 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.
> 

ok that's 'create_do' :

http://lists.nuxeo.com/pipermail/cps-devel/2006-February/002216.html

	J.


-- 
Julien Anguenot | Nuxeo R&D (Paris, France)
Open Source ECM - www.nuxeo.com
CPS Platform - http://www.cps-project.org
Mobile: +33 (0) 6 72 57 57 66

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEt2daGhoG8MxZ/pIRAj8IAJ4s7mP0i1l+0j9RjDG2glmPNykmhgCeLL+P
Tcew5pwEwnO64wsT1FEEwj8=
=SkNr
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.