source: waeup_product/trunk/skins/waeup_student/clearance.py @ 190

Last change on this file since 190 was 183, checked in by Henrik Bettermann, 19 years ago
  • Property svn:keywords set to Id
File size: 2.2 KB
RevLine 
[164]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"""
[166]7import DateTime
8current = DateTime.DateTime()
9
10
[164]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
[183]22res,psm,ds = lt.renderLayout(layout_id= 'clearance',
23                      schema_id= 'student_clearance',
[164]24                      context=context,
25                      mapping=validate and REQUEST,
26                      ob={},
27                      layout_mode='create',
[173]28                      action = "clearance",
[166]29                      submit = "submit",
[164]30                      )
[166]31
[164]32if psm == 'invalid':
[173]33    return context.clearance_form(rendered = res,
[164]34                                 psm = "Please correct your input",
35                                 ds = ds,
36                                 )
37elif psm == '':
[173]38    return context.clearance_form(rendered = res,
[164]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:
[177]47        psm = "You are not admitted"
[173]48        return context.clearance_form(rendered = res,
[164]49                                 psm = psm,
50                                 ds = ds,
51                                 )
52    sf = getattr(context,s_id,None)
53    if sf and getattr(sf,'PERSONAL',None):
[177]54        psm = "Your are already admitted, please login"
[173]55        return context.clearance_form(rendered = res,
[164]56                                 psm = psm,
57                                 ds = ds,
58                                 )
59    rset = REQUEST.set
60    student = getattr(context,s_id)
[166]61    ds.set('sc_date',current)
[173]62    student.getContent().setScratchCardData('clearance',ds)
[164]63    sc_pin =  ds.get('sc_pin')
[177]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"
[164]66                                    % (context.absolute_url(),s_id,sc_pin))
Note: See TracBrowser for help on using the repository browser.