source: WAeUP_SRP/base/skins/waeup_student/application_edit.py @ 3081

Last change on this file since 3081 was 2920, checked in by Henrik Bettermann, 17 years ago

upload missing passport before starting clearance (logic in application_edit.py completely changed)

fix Title for student_accommodation object

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1## Script (Python) "application_edit"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=REQUEST, cpsdocument_edit_and_view_button=None, action=None, portal_status_message=''
8##title=
9# $Id: application_edit.py 2920 2007-12-11 15:40:35Z henrik $
10"""
11"""
12wftool = context.portal_workflow
13from urllib import urlencode
14from Products.CPSDocument.utils import getFormUidUrlArg
15import DateTime
16current = DateTime.DateTime()
17import logging
18logger = logging.getLogger('Skins.application_edit')
19
20psm = ""
21args = {}
22
23info = context.getApplicationInfo()
24
25student = info['student']
26
27if info is None:
28    logger.info('Anonymous user tried to access %s' % REQUEST.get('URL0'))
29    return REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
30
31if info['has_passport'] and info['app_doc'].app_email:
32    logger.info('%s proceeded to start clearance' % (info['id']))
33    action = "/start_clearance"
34    base_url = student.absolute_url()
35    url = base_url + action
36    return REQUEST.RESPONSE.redirect(url)
37elif not cpsdocument_edit_and_view_button:
38    action = "/application_edit_form"
39    base_url = student.absolute_url()
40    #url = base_url + action
41    if portal_status_message:
42        args['portal_status_message'] = portal_status_message
43        url = base_url + action + '?' + urlencode(args)
44    else:
45        url = base_url + action
46    return REQUEST.RESPONSE.redirect(url)
47
48
49
50app = info['app']
51app_doc = info['app_doc']
52state = info['review_state']
53is_valid, ds = app_doc.validate(request=REQUEST,
54                                schema_id = 'student_application',
55                                layout_id = 'student_application',
56                                proxy=app,
57                                use_session=False)
58
59
60action = "/application_edit"
61base_url = app.absolute_url()
62
63if is_valid:
64    args['portal_status_message'] = "You didn't upload all required data!"
65
66else:
67    args['portal_status_message'] = "Please correct your error!"
68
69url = base_url + action + '?' + urlencode(args)
70
71
72 
73return REQUEST.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.