source: WAeUP_SRP/branches/srpp_branch/skins/waeup_student/clearance.py @ 3753

Last change on this file since 3753 was 183, checked in by Henrik Bettermann, 19 years ago
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1##parameters=REQUEST
2# $Id: clearance.py 183 2005-11-17 06:06:44Z henrik $
3"""
4process the Admission Form
5return html renderer + psm
6"""
7import DateTime
8current = DateTime.DateTime()
9
10
11type_name = 'Jamb'
12ti = context.portal_types[type_name]
13
14REQUEST.set('type_name',type_name)
15
16validate = REQUEST.has_key("cpsdocument_edit_button")
17
18
19lt = context.portal_layouts
20pr = context.portal_registration
21
22res,psm,ds = lt.renderLayout(layout_id= 'clearance',
23                      schema_id= 'student_clearance',
24                      context=context,
25                      mapping=validate and REQUEST,
26                      ob={},
27                      layout_mode='create',
28                      action = "clearance",
29                      submit = "submit",
30                      )
31
32if psm == 'invalid':
33    return context.clearance_form(rendered = res,
34                                 psm = "Please correct your input",
35                                 ds = ds,
36                                 )
37elif psm == '':
38    return context.clearance_form(rendered = res,
39                                 psm = None,
40                                 ds = ds,
41                                 )
42elif psm == 'valid':
43    s_id = "s%s" % ds.get('jamb_id')
44    catalog = context.portal_catalog
45    search = catalog(SearchableText = "%s*" % s_id)
46    if len(search) < 1:
47        psm = "You are not admitted"
48        return context.clearance_form(rendered = res,
49                                 psm = psm,
50                                 ds = ds,
51                                 )
52    sf = getattr(context,s_id,None)
53    if sf and getattr(sf,'PERSONAL',None):
54        psm = "Your are already admitted, please login"
55        return context.clearance_form(rendered = res,
56                                 psm = psm,
57                                 ds = ds,
58                                 )
59    rset = REQUEST.set
60    student = getattr(context,s_id)
61    ds.set('sc_date',current)
62    student.getContent().setScratchCardData('clearance',ds)
63    sc_pin =  ds.get('sc_pin')
64    #return REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=UnSeT&sc_pin=%s"
65    return REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=123456&sc_pin=%s"
66                                    % (context.absolute_url(),s_id,sc_pin))
Note: See TracBrowser for help on using the repository browser.