[1571] | 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 |
---|
[1575] | 7 | ##parameters=REQUEST, student=None |
---|
[1515] | 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: getStudyCourseInfo.py 1504 2007-02-26 21:20:40Z henrik $ |
---|
| 11 | """ |
---|
| 12 | close the Students StudyLevel |
---|
| 13 | """ |
---|
| 14 | try: |
---|
| 15 | from Products.zdb import set_trace |
---|
| 16 | except: |
---|
| 17 | def set_trace(): |
---|
| 18 | pass |
---|
[1575] | 19 | from urllib import urlencode |
---|
[1515] | 20 | request = context.REQUEST |
---|
| 21 | mtool = context.portal_membership |
---|
| 22 | member = mtool.getAuthenticatedMember() |
---|
| 23 | member_id = str(member) |
---|
| 24 | import logging |
---|
[1571] | 25 | logger = logging.getLogger('Skins.reject_courses') |
---|
[1515] | 26 | |
---|
| 27 | wftool = context.portal_workflow |
---|
| 28 | wftool.doActionFor(context,'open') |
---|
| 29 | wftool.doActionFor(context,'close_for_edit') |
---|
| 30 | students_folder = context.portal_url.getPortalObject().campus.students |
---|
| 31 | student = getattr(students_folder,context.getStudentId()) |
---|
| 32 | wftool.doActionFor(student,'reject_courses') |
---|
[1571] | 33 | logger.info('%s rejected course list of %s' % (member,student.getId())) |
---|
[1575] | 34 | |
---|
| 35 | args = {} |
---|
| 36 | action = "/contact_student_form_2" |
---|
| 37 | psm = "Student's course list has been rejected! Please fill and submit the form below!" |
---|
| 38 | subject = "Course list rejected" |
---|
| 39 | args['subject'] = subject |
---|
| 40 | args['continue'] = 'study_level_view' |
---|
| 41 | args['portal_status_message'] = psm |
---|
| 42 | url = context.absolute_url() + action + '?' + urlencode(args) |
---|
| 43 | return REQUEST.RESPONSE.redirect(url) |
---|
| 44 | |
---|
| 45 | #return request.RESPONSE.redirect("%s" % context.absolute_url()) |
---|