source: WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py @ 7657

Last change on this file since 7657 was 1653, checked in by uli, 18 years ago

Incorporated changeset 1593:1652 of trunk into uli-branch.

File size: 1.7 KB
RevLine 
[1593]1## Script (Python) "reject_courses"
[1515]2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
[1593]7##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None
[1515]8##title=
9##
10# $Id: getStudyCourseInfo.py 1504 2007-02-26 21:20:40Z henrik $
11"""
12close the Students StudyLevel
13"""
[1593]14from Products.CMFCore.WorkflowCore import WorkflowException
[1515]15try:
16    from Products.zdb import set_trace
17except:
18    def set_trace():
19        pass
[1593]20from urllib import urlencode
[1515]21request = context.REQUEST
22mtool = context.portal_membership
23member = mtool.getAuthenticatedMember()
24member_id = str(member)
25import logging
[1593]26logger = logging.getLogger('Skins.reject_courses')
[1515]27
28wftool = context.portal_workflow
29wftool.doActionFor(context,'open')
30wftool.doActionFor(context,'close_for_edit')
31students_folder = context.portal_url.getPortalObject().campus.students
[1593]32student_id = context.getStudentId()
33student = getattr(students_folder,student_id)
34try:
35    wftool.doActionFor(student,'reject_courses')
36except WorkflowException,E:
37    logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id))
38    return request.RESPONSE.redirect("%s" % context.absolute_url())
39logger.info('%s rejected course list of %s' % (member_id,student_id))
40
41args = {}
42
43psm = "Student's course list has been rejected! Please fill and submit the form below!"
44subject = "Course list rejected"
45args['subject'] = subject
46args['continue'] = action_after_validate
47args['portal_status_message'] = psm
[1653]48if action_after_reject:
49    url = context.absolute_url() + '/' + action_after_reject + '?' + urlencode(args)
50else:
51    url = context.absolute_url() + '?' + urlencode(args)
[1593]52return REQUEST.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.