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() > -----Message d'origine----- > De : [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 13 juillet 2006 14:27 > À : [email protected] > Objet : [CPS-devel] howto add subobject during objectcreation > > hi, > > 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. > > > > -- > 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 > Ce message et toutes les pièces jointes sont établis à l'attention exclusive de leurs destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d'en avertir immédiatement l'expéditeur. L'internet ne permettant pas d'assurer l'intégrité de ce message, le contenu de ce message ne représente en aucun cas un engagement de la part de Leroy Merlin. _______________________________________________ cps-devel mailing list http://lists.nuxeo.com/mailman/listinfo/cps-devel
