source: WAeUP_SRP/trunk/skins/waeup_student/request_clearance.py @ 790

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

clearance_edit polished,

File size: 2.0 KB
Line 
1##parameters=REQUEST
2# $Id: apply_admission.py 649 2006-10-11 06:24:39Z joachim $
3"""
4request Clearance
5"""
6import DateTime
7current = DateTime.DateTime()
8pr = context.portal_registration
9
10type_name = 'Student'
11ti = context.portal_types[type_name]
12REQUEST.set('type_name',type_name)
13redirect = REQUEST.RESPONSE.redirect
14wf = context.portal_workflow
15validate = REQUEST.has_key("cpsdocument_create_button")
16
17lt = context.portal_layouts
18pr = context.portal_registration
19
20res,psm,ds = lt.renderLayout(layout_id='student_clearance',
21                      schema_id= 'student_clearance',
22                      context=context,
23                      mapping=validate and REQUEST,
24                      ob={},
25                      layout_mode='create',
26                      formaction = "request_clearance",
27                      button = "Request Clearance",
28                      )
29if psm == 'invalid':
30    return context.clearance_pin_form(rendered = res,
31                                 psm = "Please correct your input.",
32                                 #psm = "%s, %s" % (psm,ds),
33                                 firstlayout = True,
34                                 lastlayout = True,
35                                 ds = ds,
36                                 )
37elif psm == '':
38    return context.clearance_pin_form(rendered = res,
39                                 psm = None,
40                                 firstlayout = True,
41                                 lastlayout = True,
42                                 ds = ds,
43                                 )
44elif psm == 'valid':
45    info = context.getStudentInfo()
46    review_state = info['review_state']
47    wf.doActionFor(info['student'],'enter_clearance_pin')
48    wf.doActionFor(info['app'],'close')
49    wf.doActionFor(info['clear'],'open')
50    pin = str(ds.get('clr_ac_pin'))
51    dc = {}
52    dc['clr_ac_pin'] = pin
53    dc['clr_ac_date'] = current
54    info['clear_doc'].edit(mapping = dc)
55return redirect("%s/clearance_edit_form" % info['clear'].absolute_url())
Note: See TracBrowser for help on using the repository browser.