source: WAeUP_SRP/trunk/skins/waeup_student/request_admission.py @ 462

Last change on this file since 462 was 461, checked in by joachim, 19 years ago

removed debugging from script

File size: 2.0 KB
RevLine 
[460]1##parameters=REQUEST
2# $Id: check_admission.py 173 2005-11-15 16:28:29Z joachim $
3"""
4process the Admission Form
5return html renderer + psm
6"""
7import DateTime
8current = DateTime.DateTime()
9type_name = 'StudentAdmission'
10
11ti = context.portal_types[type_name]
12
13REQUEST.set('type_name',type_name)
14
15validate = REQUEST.has_key("cpsdocument_edit_button")
16
17
18lt = context.portal_layouts
19pr = context.portal_registration
20
21res,psm,ds = lt.renderLayout(layout_id= 'student_check_pin',
22                      schema_id= 'student_admission',
23                      context=context,
24                      mapping=validate and REQUEST,
25                      ob={},
26                      layout_mode='create',
27                      formaction = "request_admission",
28                      submit = "check",
29                      )
30if psm == 'invalid':
31    return context.request_admission_form(rendered = res,
32                                 psm = "Please correct your input",
33                                 ds = ds,
34                                 )
35elif psm == '':
36    return context.request_admission_form(rendered = res,
37                                 psm = None,
38                                 ds = ds,
39                                 )
40elif psm == 'valid':
41    jamb_id = ds.get('jamb_id')
42    catalog = context.portal_catalog
43    search = catalog({'meta_type': 'StudentAdmission',
44                     'jamb_reg_no': jamb_id
45                     })
46   
[461]47    if len(search) < 1:
48        psm = "No JAMB record %s" % (jamb_id)
[460]49        return context.check_admission_form(rendered = res,
50                                 psm = psm,
51                                 ds = ds,
52                                 )
53student = search[0].getObject().aq_parent
54
55return student.acknowledge_slip()
56
57jamb = getattr(student,'admission')
58res = jamb.getContent().render(layout_id = 'admission_slip',
59                               layout_mode = 'view',
60                               schema_id = 'jamb')
61
62return context.admission_slip_form(rendered = res, dict = ds)
63
Note: See TracBrowser for help on using the repository browser.