source: WAeUP_SRP/trunk/skins/waeup_academics/department_created.py @ 533

Last change on this file since 533 was 486, checked in by joachim, 18 years ago

svn -R propset svn:keywords "Id" .
added layout_application_/edit/create/view
and cleaned that up.

  • Property svn:keywords set to Id
File size: 1.0 KB
RevLine 
[310]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"""
[486]18# $Id: department_created.py 486 2006-09-06 10:09:39Z joachim $
[310]19if object is not None:
20    dep = object
21else:
22    dep = context.getContent()
[319]23dep.invokeFactory('CoursesFolder','courses')
[321]24o = getattr(dep,'courses')
[310]25dict = {'Title': 'Courses'}
26o.getContent().edit(mapping=dict)
[319]27dep.invokeFactory('CertificatesFolder','certificates')
[321]28o = getattr(dep,'certificates')
[310]29dict = {'Title': 'Certificates'}
30o.getContent().edit(mapping=dict)
31psm = 'Department with Certificates and Courses created'
32action_path = context.getTypeInfo().immediate_view
33context.REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' %
34                                  (context.absolute_url(), action_path, psm))
Note: See TracBrowser for help on using the repository browser.