## 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: cpsdocument_created.py 8901 2003-10-14 12:14:25Z fguillaume $ 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))