##parameters=REQUEST # $Id: clearance.py 177 2005-11-16 08:16:29Z henrik $ """ process the Admission Form return html renderer + psm """ import DateTime current = DateTime.DateTime() type_name = 'Jamb' ti = context.portal_types[type_name] REQUEST.set('type_name',type_name) validate = REQUEST.has_key("cpsdocument_edit_button") lt = context.portal_layouts pr = context.portal_registration res,psm,ds = lt.renderLayout(layout_id= 'clearence', schema_id= 'student_clearence', context=context, mapping=validate and REQUEST, ob={}, layout_mode='create', action = "clearance", submit = "submit", ) if psm == 'invalid': return context.clearance_form(rendered = res, psm = "Please correct your input", ds = ds, ) elif psm == '': return context.clearance_form(rendered = res, psm = None, ds = ds, ) elif psm == 'valid': s_id = "s%s" % ds.get('jamb_id') catalog = context.portal_catalog search = catalog(SearchableText = "%s*" % s_id) if len(search) < 1: psm = "You are not admitted" return context.clearance_form(rendered = res, psm = psm, ds = ds, ) sf = getattr(context,s_id,None) if sf and getattr(sf,'PERSONAL',None): psm = "Your are already admitted, please login" return context.clearance_form(rendered = res, psm = psm, ds = ds, ) rset = REQUEST.set student = getattr(context,s_id) ds.set('sc_date',current) student.getContent().setScratchCardData('clearance',ds) sc_pin = ds.get('sc_pin') #return REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=UnSeT&sc_pin=%s" return REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=123456&sc_pin=%s" % (context.absolute_url(),s_id,sc_pin))