- Timestamp:
- 19 Mar 2007, 18:57:54 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py
r1520 r1593 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= 7 ##parameters=REQUEST=None, action_after_validate=None 8 8 ##title= 9 9 ## … … 12 12 add a StudentCourseResult object 13 13 """ 14 15 import logging 16 logger = logging.getLogger('Skins.add_course_result') 17 14 18 from urllib import urlencode 15 19 try: … … 23 27 aq_portal = context.portal_catalog.evalAdvancedQuery 24 28 course_id = request.get('course_id') 29 30 mtool = context.portal_membership 31 member = mtool.getAuthenticatedMember() 32 33 25 34 d = context.getCourseInfo(course_id) 26 35 args = {} … … 28 37 while True: 29 38 if d['title'] == 'unknown': 30 err = "No such course" 39 err = "No such course!" 40 logger.info('%s tried to add StudentCourseResult object %s for non-existing course' % (member,course_id)) 31 41 break 32 42 if context.hasObject(course_id): 33 err = "Course already exists" 43 err = "Course already exists!" 44 logger.info('%s tried to add StudentCourseResult object %s which is already in course list' % (member,course_id)) 34 45 break 35 46 if context.hasObject("%s_co" % course_id): 36 err = "Course already exists as carryover course" 47 err = "Course already exists as carryover course!" 48 logger.info('%s tried to add StudentCourseResult object %s which already exists as carryover course' % (member,course_id)) 37 49 break 38 50 break … … 40 52 if err: 41 53 args['course_id'] = course_id 42 args['error'] = err 54 #args['error'] = err 55 args['portal_status_message'] = err 43 56 url = "%s?%s" % (context.absolute_url(),urlencode(args)) 44 57 return request.RESPONSE.redirect(url) 58 59 45 60 cr_id = context.invokeFactory('StudentCourseResult',course_id) 46 61 #set_trace() … … 50 65 context.portal_workflow.doActionFor(cr,'close') 51 66 args['course_id'] = course_id 52 from urllib import urlencode53 url = "%s?%s" % (context.absolute_url(),urlencode(args))54 return request.RESPONSE.redirect(url)55 67 68 logger.info('%s added StudentCourseResult object %s' % (member,course_id)) 69 70 args = {} 71 psm = "You successfully added course %s!" % course_id 72 args['portal_status_message'] = psm 73 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 74 return REQUEST.RESPONSE.redirect(url) 75
Note: See TracChangeset for help on using the changeset viewer.