source: WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py @ 892

Last change on this file since 892 was 892, checked in by Henrik Bettermann, 18 years ago

all psm checked and edited

  • Property svn:keywords set to Id
File size: 2.5 KB
RevLine 
[798]1##parameters=REQUEST
[805]2# $Id: start_clearance.py 892 2006-11-18 21:14:18Z henrik $
[798]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 = "start_clearance",
27                      button = "Start",
28                      )
29
30info = context.getStudentInfo()
31app_doc = info['app_doc']
32if app_doc.passport is None:
33    return context.clearance_pin_form(rendered = res,
[892]34                                 psm = "You must upload your passport picture before you can start the registration process!",
[798]35                                 #psm = "%s, %s" % (psm,ds),
36                                 firstlayout = True,
37                                 lastlayout = True,
38                                 ds = ds,
39                                 )
40
41if psm == 'invalid':
42    return context.clearance_pin_form(rendered = res,
[892]43                                 psm = "Please correct your input!",
[798]44                                 #psm = "%s, %s" % (psm,ds),
45                                 firstlayout = True,
46                                 lastlayout = True,
47                                 ds = ds,
48                                 )
49elif psm == '':
50    return context.clearance_pin_form(rendered = res,
51                                 psm = None,
52                                 firstlayout = True,
53                                 lastlayout = True,
54                                 ds = ds,
55                                 )
56elif psm == 'valid':
57    info = context.getStudentInfo()
58    review_state = info['review_state']
59    wf.doActionFor(info['student'],'enter_clearance_pin')
60    wf.doActionFor(info['app'],'close')
61    wf.doActionFor(info['clear'],'open')
62    pin = str(ds.get('clr_ac_pin'))
63    dc = {}
64    dc['clr_ac_pin'] = pin
65    dc['clr_ac_date'] = current
[843]66    dc['entry_date'] = current
67    dc['entry_session'] = "2006/2007"
[798]68    info['clear_doc'].edit(mapping = dc)
69return redirect("%s/clearance_edit_form" % info['clear'].absolute_url())
Note: See TracBrowser for help on using the repository browser.