## Script (Python) "cpsdocument_created" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=object=None ##title= ## """ Do the necessary rendering or redirection after an object has been successfully created and filled with the initial values by the user. In CPS, context is a proxy. May return a rendered document, or do a redirect. """ # $Id: department_created.py 486 2006-09-06 10:09:39Z joachim $ if object is not None: dep = object else: dep = context.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) psm = 'Department with Certificates and Courses created' action_path = context.getTypeInfo().immediate_view context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % (context.absolute_url(), action_path, psm))