1 | ##parameters=REQUEST |
---|
2 | # $Id: apply_admission.py 649 2006-10-11 06:24:39Z joachim $ |
---|
3 | """ |
---|
4 | request Clearance |
---|
5 | """ |
---|
6 | import DateTime |
---|
7 | current = DateTime.DateTime() |
---|
8 | pr = context.portal_registration |
---|
9 | |
---|
10 | |
---|
11 | type_name = 'StudentApplication' |
---|
12 | ti = context.portal_types[type_name] |
---|
13 | REQUEST.set('type_name',type_name) |
---|
14 | |
---|
15 | validate = REQUEST.has_key("cpsdocument_create_button") |
---|
16 | |
---|
17 | lt = context.portal_layouts |
---|
18 | pr = context.portal_registration |
---|
19 | |
---|
20 | res,psm,ds = lt.renderLayout(layout_id= 'student_application_fe', |
---|
21 | schema_id= 'student_application', |
---|
22 | context=context, |
---|
23 | mapping=validate and REQUEST, |
---|
24 | ob={}, |
---|
25 | layout_mode='create', |
---|
26 | formaction = "request_clearance", |
---|
27 | button = "Request Clearance", |
---|
28 | ) |
---|
29 | if 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 | ) |
---|
37 | elif psm == '': |
---|
38 | return context.clearance_pin_form(rendered = res, |
---|
39 | psm = None, |
---|
40 | firstlayout = True, |
---|
41 | lastlayout = True, |
---|
42 | ds = ds, |
---|
43 | ) |
---|
44 | elif psm == 'valid': |
---|
45 | s_id = ds.get('s_id') |
---|
46 | pin = str(ds.get('app_ac_pin')) |
---|
47 | return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s" |
---|
48 | % (context.absolute_url(),s_id,pin.split('-')[2],pin)) |
---|
49 | return |
---|
50 | |
---|
51 | |
---|