Last change
on this file was
892,
checked in by Henrik Bettermann, 18 years ago
|
all psm checked and edited
|
-
Property svn:keywords set to
Id
|
File size:
935 bytes
|
Rev | Line | |
---|
[731] | 1 | ## Script (Python) "cpsdocument_created" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=object=None |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | """ |
---|
| 11 | Do the necessary rendering or redirection after an object has been |
---|
| 12 | successfully created and filled with the initial values by the user. |
---|
| 13 | |
---|
| 14 | In CPS, context is a proxy. |
---|
| 15 | |
---|
| 16 | May return a rendered document, or do a redirect. |
---|
| 17 | """ |
---|
[805] | 18 | # $Id: student_course_result_created.py 892 2006-11-18 21:14:18Z henrik $ |
---|
[731] | 19 | if object is not None: |
---|
| 20 | course = object |
---|
| 21 | else: |
---|
| 22 | course = context |
---|
| 23 | real_course = context.findCourseById(course.getId()) |
---|
| 24 | from_real_course = ('title','credits','passmark') |
---|
| 25 | d = {} |
---|
| 26 | for f in from_real_course: |
---|
| 27 | d[f] = getattr(real_course,f) |
---|
| 28 | course.getContent().edit(mapping=d) |
---|
[892] | 29 | psm = 'CourseResult created!' |
---|
[731] | 30 | action_path = context.getTypeInfo().immediate_view |
---|
| 31 | context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % |
---|
| 32 | (context.absolute_url(), action_path, psm)) |
---|
Note: See
TracBrowser for help on using the repository browser.