##parameters=REQUEST,matric_no # $Id: set_access_data.py 1151 2006-12-29 22:05:53Z joachim $ """ process the Application Form return html renderer + psm """ import DateTime current = DateTime.DateTime() pr = context.portal_registration validate = REQUEST.has_key("cpsdocument_edit_button") lt = context.portal_layouts #pr = context.portal_registration default = {'matric_no':matric_no} res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search', schema_id= 'student_returning', context=context, mapping=validate and REQUEST, ob=default, layout_mode='edit', formaction = "set_access_data", button = "Search", matric_no = matric_no, commit = False, ) if psm == 'invalid': return context.set_access_data_form(rendered = res, psm = "Please correct your input!", #psm = "%s, %s" % (psm,ds), firstlayout = True, lastlayout = True, ds = ds, ) elif psm == '': return context.set_access_data_form(rendered = res, psm = None, firstlayout = True, lastlayout = True, ds = ds, ) elif psm == 'valid': pass #jamb_reg_no = ds.get('jamb_reg_no') #r = context.returning_import(matric_no = matric_no) #if 0 and r and r[0].Entryregno != jamb_reg_no or not r: # psm = "Your Jamb Registration Nr is wrong" # return context.set_access_data_form(rendered = res, # psm = psm, # firstlayout = True, # lastlayout = True, # ds = ds, # ) from Products.zdb import set_trace;set_trace() password = REQUEST.get('widget__password') email = ds.get('email') st_res = context.students_catalog(matric_no = matric_no) if st_res: sid = st_res[0].id context.waeup_tool.makeStudentMember(sid,password=password) args = {} args['__ac_name'] = sid args['__ac_password'] = password args['returning'] = '1' args['email'] = email from urllib import urlencode url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args)) return REQUEST.RESPONSE.redirect(url)