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: cpsdocument_created.py 8901 2003-10-14 12:14:25Z fguillaume $ |
---|
19 | if object is not None: |
---|
20 | dep = object |
---|
21 | else: |
---|
22 | dep = context.getContent() |
---|
23 | dep.invokeFactory('CoursesFolder','courses') |
---|
24 | o = getattr(dep,'courses') |
---|
25 | dict = {'Title': 'Courses'} |
---|
26 | o.getContent().edit(mapping=dict) |
---|
27 | dep.invokeFactory('CertificatesFolder','certificates') |
---|
28 | o = getattr(dep,'certificates') |
---|
29 | dict = {'Title': 'Certificates'} |
---|
30 | o.getContent().edit(mapping=dict) |
---|
31 | psm = 'Department with Certificates and Courses created' |
---|
32 | action_path = context.getTypeInfo().immediate_view |
---|
33 | context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' % |
---|
34 | (context.absolute_url(), action_path, psm)) |
---|