##parameters=REQUEST # $Id: check_admission.py 892 2006-11-18 21:14:18Z henrik $ """ request Clearance """ import DateTime from urllib import urlencode current = DateTime.DateTime() pr = context.portal_registration type_name = 'StudentApplication' 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_application_fe', schema_id= 'student_application', context=context, mapping=validate and REQUEST, ob={}, layout_mode='create', formaction = "check_admission", button = "Check", ) if psm == 'invalid': return context.check_admission_pin_form(rendered = res, psm = "Please correct your input!", #psm = "%s, %s" % (psm,ds), firstlayout = True, lastlayout = True, ds = ds, ) elif psm == '': return context.check_admission_pin_form(rendered = res, psm = None, firstlayout = True, lastlayout = True, ds = ds, ) elif psm == 'valid': s_id = ds.get('s_id') email = ds.get('app_email') student = getattr(context.campus.students, s_id) review_state = wf.getInfoFor(student,'review_state',None) if review_state == "admission_rejected": url = "%s/campus/students/%s/pume/admission_rejected_view" % (context.portal_url(),s_id) return redirect(url) pin = str(ds.get('app_ac_pin')) args = {} args['__ac_name'] = s_id args['__ac_password'] = pin.split('-')[2] args['pin'] = pin args['email'] = email url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args)) return redirect(url)