source: waeup_product/trunk/skins/waeup_default/create_common.py @ 207

Last change on this file since 207 was 103, checked in by joachim, 19 years ago

=accommodationhall

  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1##parameters=REQUEST=None
2# $Id: create_common.py 103 2005-10-27 16:06:03Z joachim $
3"""
4Create a Faculty
5
6"""
7type_name = REQUEST.get('type_name')
8
9ti = context.portal_types[type_name]
10pr = context.portal_registration
11pm = context.portal_membership
12
13validate = REQUEST.has_key("cpsdocument_create_button")
14
15lt = context.portal_layouts
16
17res,psm,ds = lt.renderLayout(layout_id= type_name.lower(),
18                      schema_id= 'metadata',
19                      context=context,
20                      mapping=validate and REQUEST,
21                      ob={},
22                      layout_mode='create',
23                      )
24if psm == 'invalid':
25    return context.common_edit_form(rendered = res,
26                                 create = 1,
27                                 type_name = type_name,
28                                 psm = 'Please correct your errors',
29                                 )
30elif psm == '':
31    return context.common_edit_form(rendered = res,
32                                 create = 1,
33                                 type_name = type_name,
34                                 psm = psm,
35                                 )
36   
37elif psm == 'valid':
38    oid = "%s" % ds.get('Title').replace(' ','')
39    context.invokeFactory(type_name,oid)
40    object = getattr(context,oid)   
41    object.getContent().edit(mapping=ds)
42    context.notifyCPSDocumentCreation(ob=object)
43    psm = 'new %s created' % oid
44    context_ti = context.portal_types[context.portal_type]
45    index = context_ti.getActionById('view','university_view')
46    return getattr(context,index)(psm=psm)
47
Note: See TracBrowser for help on using the repository browser.