howto add subobject during objectcreation

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