source: WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py @ 1169

Last change on this file since 1169 was 1169, checked in by joachim, 18 years ago

display_session_results now asks for jamb_reg_no
set_access_data uses this information
permission mappings for new states in waeup_student_wf added
set_access_data is now called from a form

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1##parameters=REQUEST,matric_no
2# $Id: set_access_data.py 1169 2007-01-01 16:38:46Z joachim $
3"""
4process the Application Form
5return html renderer + psm
6"""
7import DateTime
8current = DateTime.DateTime()
9pr = context.portal_registration
10
11validate = REQUEST.has_key("cpsdocument_edit_button")
12
13lt = context.portal_layouts
14#pr = context.portal_registration
15default = {'matric_no':matric_no}
16res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search',
17                      schema_id= 'student_returning',
18                      context=context,
19                      mapping=validate and REQUEST,
20                      ob=default,
21                      layout_mode='edit',
22                      formaction = "set_access_data",
23                      button = "Search",
24                      matric_no = matric_no,
25                      commit = False,
26                      )
27if psm == 'invalid':
28    return context.set_access_data_form(rendered = res,
29                                 psm = "Please correct your input!",
30                                 #psm = "%s, %s" % (psm,ds),
31                                 firstlayout = True,
32                                 lastlayout = True,
33                                 ds = ds,
34                                 )
35elif psm == '':
36    return context.set_access_data_form(rendered = res,
37                                 psm = None,
38                                 firstlayout = True,
39                                 lastlayout = True,
40                                 ds = ds,
41                                 )
42elif psm == 'valid':
43    pass
44##    jamb_reg_no = ds.get('jamb_reg_no')
45##    r = context.returning_import(matric_no = matric_no)
46##    if r and r[0].Entryregno != jamb_reg_no or not r:
47##        psm = "Your Jamb Registration Nr is wrong"
48##        return context.set_access_data_form(rendered = res,
49##                                 psm = psm,
50##                                 firstlayout = True,
51##                                 lastlayout = True,
52##                                 ds = ds,
53##                                 )
54## from Products.zdb import set_trace;set_trace()
55password = REQUEST.get('widget__password')
56email = ds.get('email')
57st_res = context.students_catalog(matric_no = matric_no)
58if st_res:
59    sid = st_res[0].id
60context.waeup_tool.makeStudentMember(sid,password=password)
61args = {}
62args['__ac_name'] = sid
63args['__ac_password'] = password
64args['returning'] = '1'
65args['email'] = email
66args['phone_nr'] = ds.get('phone_nr')
67from urllib import urlencode
68url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
69return REQUEST.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.