## 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: student_course_result_created.py 892 2006-11-18 21:14:18Z henrik $ if object is not None: course = object else: course = context real_course = context.findCourseById(course.getId()) from_real_course = ('title','credits','passmark') d = {} for f in from_real_course: d[f] = getattr(real_course,f) course.getContent().edit(mapping=d) psm = 'CourseResult created!' action_path = context.getTypeInfo().immediate_view context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % (context.absolute_url(), action_path, psm))