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

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

added missing layout student_check_pin
added validation for JAMB reg_no

File size: 1.7 KB
Line 
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   
47    if len(search) < 1:
48        psm = "No JAMB record %s" % (jamb_id)
49        return context.request_admission_form(rendered = res,
50                                 psm = psm,
51                                 ds = ds,
52                                 )
53student = search[0].getObject().aq_parent
54
55return student.acknowledge_slip()
56
57
Note: See TracBrowser for help on using the repository browser.