##parameters=REQUEST # $Id: apply_admission.py 649 2006-10-11 06:24:39Z joachim $ """ request Clearance """ import DateTime current = DateTime.DateTime() pr = context.portal_registration type_name = 'Student' ti = context.portal_types[type_name] REQUEST.set('type_name',type_name) redirect = REQUEST.RESPONSE.redirect wf = context.portal_workflow validate = REQUEST.has_key("cpsdocument_create_button") lt = context.portal_layouts pr = context.portal_registration res,psm,ds = lt.renderLayout(layout_id='student_clearance', schema_id= 'student_clearance', context=context, mapping=validate and REQUEST, ob={}, layout_mode='create', formaction = "request_clearance", button = "Request Clearance", ) if psm == 'invalid': return context.clearance_pin_form(rendered = res, psm = "Please correct your input.", #psm = "%s, %s" % (psm,ds), firstlayout = True, lastlayout = True, ds = ds, ) elif psm == '': return context.clearance_pin_form(rendered = res, psm = None, firstlayout = True, lastlayout = True, ds = ds, ) elif psm == 'valid': info = context.getStudentInfo() review_state = info['review_state'] wf.doActionFor(info['student'],'enter_clearance_pin') wf.doActionFor(info['app'],'close') wf.doActionFor(info['clear'],'open') pin = str(ds.get('clr_ac_pin')) dc = {} dc['clr_ac_pin'] = pin dc['clr_ac_date'] = current info['clear_doc'].edit(mapping = dc) return redirect("%s/clearance_edit_form" % info['clear'].absolute_url())