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

Last change on this file since 1200 was 1179, checked in by Henrik Bettermann, 18 years ago

GPA calculation
medical hostel allocation corrected
and beautifying

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