## Script (Python) "register_courses" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None ##title= ## # $Id: getStudyCourseInfo.py 1504 2007-02-26 21:20:40Z henrik $ """ close the Students StudyLevel """ from Products.CMFCore.WorkflowCore import WorkflowException try: from Products.zdb import set_trace except: def set_trace(): pass from urllib import urlencode request = context.REQUEST mtool = context.portal_membership member = mtool.getAuthenticatedMember() member_id = str(member) import logging logger = logging.getLogger('Skins.register_courses') wftool = context.portal_workflow students_folder = context.portal_url.getPortalObject().campus.students student_id = context.getStudentId() student = getattr(students_folder,student_id) try: wftool.doActionFor(context,'close') except WorkflowException,E: #logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) #return request.RESPONSE.redirect("%s" % context.absolute_url()) pass try: wftool.doActionFor(student,'register_courses') except WorkflowException,E: logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) return request.RESPONSE.redirect("%s" % context.absolute_url()) logger.info('%s registered course list of %s' % (member_id,student_id)) args = {} psm = "You successfully submitted your course list!" args['portal_status_message'] = psm if action_after_validate: url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) else: url = context.absolute_url() + '?' + urlencode(args) return REQUEST.RESPONSE.redirect(url)