source: waeup_product/trunk/skins/waeup_student/check_admission.py @ 127

Last change on this file since 127 was 106, checked in by joachim, 19 years ago

=fixes for Henrik

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