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 | """ |
---|
18 | # $Id: level_created.py 892 2006-11-18 21:14:18Z henrik $ |
---|
19 | if object is not None: |
---|
20 | dep = object |
---|
21 | else: |
---|
22 | dep = context.getContent() |
---|
23 | dep.getContent().edit(mapping={'Title': "Level %s" % dep.getId()}) |
---|
24 | #dep.invokeFactory('Semester','first') |
---|
25 | #o = getattr(dep,'first') |
---|
26 | #dict = {'Title': 'First Semester'} |
---|
27 | #o.getContent().edit(mapping=dict) |
---|
28 | #dep.invokeFactory('Semester','second') |
---|
29 | #o = getattr(dep,'second') |
---|
30 | #dict = {'Title': 'Second Semester'} |
---|
31 | #o.getContent().edit(mapping=dict) |
---|
32 | #context.orderObjects('id') |
---|
33 | psm = 'Study Level created!' |
---|
34 | action_path = context.getTypeInfo().immediate_view |
---|
35 | context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % |
---|
36 | (context.absolute_url(), action_path, psm)) |
---|