source: WAeUP_SRP/trunk/skins/waeup_academics/level_created.py @ 327

Last change on this file since 327 was 326, checked in by joachim, 19 years ago

=several types + views

File size: 1.1 KB
Line 
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"""
11Do the necessary rendering or redirection after an object has been
12successfully created and filled with the initial values by the user.
13
14In CPS, context is a proxy.
15
16May return a rendered document, or do a redirect.
17"""
18# $Id: cpsdocument_created.py 8901 2003-10-14 12:14:25Z fguillaume $
19if object is not None:
20    dep = object
21else:
22    dep = context.getContent()
23dep.invokeFactory('Semester','first')
24o = getattr(dep,'first')
25dict = {'Title': 'First Semester'}
26o.getContent().edit(mapping=dict)
27dep.invokeFactory('Semester','second')
28o = getattr(dep,'second')
29dict = {'Title': 'Second Semester'}
30o.getContent().edit(mapping=dict)
31context.orderObjects('id')
32psm = 'Study Level created'
33action_path = context.getTypeInfo().immediate_view
34context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' %
35                                  (context.absolute_url(), action_path, psm))
Note: See TracBrowser for help on using the repository browser.