[1596] | 1 | ## Script (Python) "validate_courses" |
---|
[1513] | 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
[1596] | 7 | ##parameters=student=None, action_after_reject=None, action_after_validate=None |
---|
[1513] | 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: getStudyCourseInfo.py 1504 2007-02-26 21:20:40Z henrik $ |
---|
| 11 | """ |
---|
| 12 | close the Students StudyLevel |
---|
| 13 | """ |
---|
[1597] | 14 | from Products.CMFCore.WorkflowCore import WorkflowException |
---|
[1513] | 15 | try: |
---|
| 16 | from Products.zdb import set_trace |
---|
| 17 | except: |
---|
| 18 | def set_trace(): |
---|
| 19 | pass |
---|
| 20 | |
---|
| 21 | request = context.REQUEST |
---|
| 22 | mtool = context.portal_membership |
---|
| 23 | member = mtool.getAuthenticatedMember() |
---|
| 24 | member_id = str(member) |
---|
| 25 | import logging |
---|
[1596] | 26 | logger = logging.getLogger('Skins.validate_courses') |
---|
[1513] | 27 | |
---|
| 28 | wftool = context.portal_workflow |
---|
| 29 | students_folder = context.portal_url.getPortalObject().campus.students |
---|
[1597] | 30 | student_id = context.getStudentId() |
---|
| 31 | student = getattr(students_folder,student_id) |
---|
| 32 | try: |
---|
| 33 | wftool.doActionFor(student,'validate_courses') |
---|
| 34 | except WorkflowException,E: |
---|
| 35 | logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) |
---|
| 36 | return request.RESPONSE.redirect("%s" % context.absolute_url()) |
---|
| 37 | logger.info('%s validated course list of %s' % (member_id,student_id)) |
---|
[1596] | 38 | |
---|
| 39 | psm = 'portal_status_message=Course list validated!' |
---|
| 40 | url = context.absolute_url() + '/' + action_after_validate + '?' + psm |
---|
| 41 | return request.RESPONSE.redirect(url) |
---|