- Timestamp:
- 19 Mar 2007, 18:57:54 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py
r1513 r1593 1 ## Script (Python) " getStudyCourseInfo"1 ## Script (Python) "register_courses" 2 2 ##bind container=container 3 3 ##bind context=context … … 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= student=None7 ##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None 8 8 ##title= 9 9 ## … … 12 12 close the Students StudyLevel 13 13 """ 14 from Products.CMFCore.WorkflowCore import WorkflowException 14 15 try: 15 16 from Products.zdb import set_trace … … 18 19 pass 19 20 21 from urllib import urlencode 22 20 23 request = context.REQUEST 21 24 mtool = context.portal_membership … … 23 26 member_id = str(member) 24 27 import logging 25 logger = logging.getLogger('S tudent.register_courses')28 logger = logging.getLogger('Skins.register_courses') 26 29 27 30 wftool = context.portal_workflow 28 wftool.doActionFor(context,'close')29 31 students_folder = context.portal_url.getPortalObject().campus.students 30 student = getattr(students_folder,context.getStudentId()) 31 wftool.doActionFor(student,'register_courses') 32 logger.info('"%s","courses registered"' % student.getId()) 33 return request.RESPONSE.redirect("%s" % context.absolute_url()) 32 student_id = context.getStudentId() 33 student = getattr(students_folder,student_id) 34 try: 35 wftool.doActionFor(context,'close') 36 except WorkflowException,E: 37 logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) 38 return request.RESPONSE.redirect("%s" % context.absolute_url()) 39 try: 40 wftool.doActionFor(student,'register_courses') 41 except WorkflowException,E: 42 logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) 43 return request.RESPONSE.redirect("%s" % context.absolute_url()) 44 logger.info('%s registered course list of %s' % (member_id,student_id)) 45 46 args = {} 47 psm = "You successfully submitted your course list!" 48 args['portal_status_message'] = psm 49 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 50 return REQUEST.RESPONSE.redirect(url)
Note: See TracChangeset for help on using the changeset viewer.