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

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

check acknowledge box,
add logging messages.

  • Property svn:keywords set to Id
File size: 2.4 KB
RevLine 
[1151]1##parameters=REQUEST,matric_no
2# $Id: set_access_data.py 1177 2007-01-02 15:02:02Z joachim $
3"""
4process the Application Form
5return html renderer + psm
6"""
[1177]7import DateTime,logging
[1151]8current = DateTime.DateTime()
9pr = context.portal_registration
[1177]10logger = logging.getLogger('Returning')
[1151]11validate = REQUEST.has_key("cpsdocument_edit_button")
12
13lt = context.portal_layouts
14#pr = context.portal_registration
15default = {'matric_no':matric_no}
[1177]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)
[1151]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                      )
[1177]32if psm == '':
[1151]33    return context.set_access_data_form(rendered = res,
[1177]34                                 psm = None,
[1151]35                                 firstlayout = True,
36                                 lastlayout = True,
37                                 ds = ds,
[1177]38                                 name = "%(name)s" % REQUEST.form
[1151]39                                 )
[1177]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 != '':
[1151]47    return context.set_access_data_form(rendered = res,
[1177]48                                 #psm = "%s, %s" % (psm,ds),
49                                 psm = psm,
[1151]50                                 firstlayout = True,
51                                 lastlayout = True,
52                                 ds = ds,
[1177]53                                 name = "%(name)s" % REQUEST.form
[1151]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
[1169]63args['phone_nr'] = ds.get('phone_nr')
[1151]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.