1 | ##parameters=REQUEST |
---|
2 | # $Id: check_admission.py 173 2005-11-15 16:28:29Z joachim $ |
---|
3 | """ |
---|
4 | process the Admission Form |
---|
5 | return html renderer + psm |
---|
6 | """ |
---|
7 | import DateTime |
---|
8 | current = DateTime.DateTime() |
---|
9 | type_name = 'StudentAdmission' |
---|
10 | |
---|
11 | ti = context.portal_types[type_name] |
---|
12 | |
---|
13 | REQUEST.set('type_name',type_name) |
---|
14 | |
---|
15 | validate = REQUEST.has_key("cpsdocument_edit_button") |
---|
16 | |
---|
17 | |
---|
18 | lt = context.portal_layouts |
---|
19 | pr = context.portal_registration |
---|
20 | |
---|
21 | res,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 | ) |
---|
30 | if psm == 'invalid': |
---|
31 | return context.request_admission_form(rendered = res, |
---|
32 | psm = "Please correct your input", |
---|
33 | ds = ds, |
---|
34 | ) |
---|
35 | elif psm == '': |
---|
36 | return context.request_admission_form(rendered = res, |
---|
37 | psm = None, |
---|
38 | ds = ds, |
---|
39 | ) |
---|
40 | elif 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 | ) |
---|
53 | student = search[0].getObject().aq_parent |
---|
54 | |
---|
55 | return student.acknowledge_slip() |
---|
56 | |
---|
57 | |
---|