source: WAeUP_SRP/trunk/skins/waeup_student/reject_courses.py @ 8794

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

close_for_edit deprecated

Objects should always be opened unless the verdict has been imported.

We need a script which opens all levels before we import the verdicts.

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