## 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: level_created.py 486 2006-09-06 10:09:39Z joachim $ if object is not None: dep = object else: dep = context.getContent() dep.getContent().edit(mapping={'Title': "Level %s" % dep.getId()}) dep.invokeFactory('Semester','first') o = getattr(dep,'first') dict = {'Title': 'First Semester'} o.getContent().edit(mapping=dict) dep.invokeFactory('Semester','second') o = getattr(dep,'second') dict = {'Title': 'Second Semester'} o.getContent().edit(mapping=dict) context.orderObjects('id') psm = 'Study Level created' action_path = context.getTypeInfo().immediate_view context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % (context.absolute_url(), action_path, psm))