source: WAeUP_SRP/trunk/skins/waeup_student/check_admission.py @ 909

Last change on this file since 909 was 892, checked in by Henrik Bettermann, 18 years ago

all psm checked and edited

  • Property svn:keywords set to Id
File size: 2.1 KB
RevLine 
[766]1##parameters=REQUEST
[805]2# $Id: check_admission.py 892 2006-11-18 21:14:18Z henrik $
[766]3"""
4request Clearance
5"""
6import DateTime
[788]7from urllib import urlencode
[766]8current = DateTime.DateTime()
9pr = context.portal_registration
10type_name = 'StudentApplication'
11ti = context.portal_types[type_name]
12REQUEST.set('type_name',type_name)
[785]13redirect = REQUEST.RESPONSE.redirect
14wf = context.portal_workflow
[766]15validate = REQUEST.has_key("cpsdocument_create_button")
16
17lt = context.portal_layouts
18pr = context.portal_registration
19
20res,psm,ds = lt.renderLayout(layout_id= 'student_application_fe',
21                      schema_id= 'student_application',
22                      context=context,
23                      mapping=validate and REQUEST,
24                      ob={},
25                      layout_mode='create',
[785]26                      formaction = "check_admission",
[799]27                      button = "Check",
[766]28                      )
29if psm == 'invalid':
[785]30    return context.check_admission_pin_form(rendered = res,
[892]31                                 psm = "Please correct your input!",
[766]32                                 #psm = "%s, %s" % (psm,ds),
33                                 firstlayout = True,
34                                 lastlayout = True,
35                                 ds = ds,
36                                 )
37elif psm == '':
[785]38    return context.check_admission_pin_form(rendered = res,
[766]39                                 psm = None,
40                                 firstlayout = True,
41                                 lastlayout = True,
42                                 ds = ds,
43                                 )
44elif psm == 'valid':
45    s_id = ds.get('s_id')
[788]46    email = ds.get('app_email')
[785]47    student = getattr(context.campus.students, s_id)
48    review_state = wf.getInfoFor(student,'review_state',None)
[797]49    if review_state == "admission_rejected":
50        url = "%s/campus/students/%s/pume/admission_rejected_view" % (context.portal_url(),s_id)
[785]51        return redirect(url)
[766]52    pin = str(ds.get('app_ac_pin'))
[788]53    args = {}
54    args['__ac_name'] = s_id
55    args['__ac_password'] = pin.split('-')[2]
56    args['pin'] = pin
57    args['email'] = email
58    url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
59    return redirect(url)
Note: See TracBrowser for help on using the repository browser.