Ignore:
Timestamp:
19 Mar 2007, 18:57:54 (18 years ago)
Author:
uli
Message:

Merged current trunk into uli-branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py

    r1520 r1593  
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=
     7##parameters=REQUEST=None, action_after_validate=None
    88##title=
    99##
     
    1212add a StudentCourseResult object
    1313"""
     14
     15import logging
     16logger = logging.getLogger('Skins.add_course_result')
     17
    1418from urllib import urlencode
    1519try:
     
    2327aq_portal = context.portal_catalog.evalAdvancedQuery
    2428course_id = request.get('course_id')
     29
     30mtool = context.portal_membership
     31member = mtool.getAuthenticatedMember()
     32
     33
    2534d = context.getCourseInfo(course_id)
    2635args = {}
     
    2837while True:
    2938    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))
    3141        break
    3242    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))
    3445        break
    3546    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))
    3749        break
    3850    break
     
    4052if err:
    4153    args['course_id'] = course_id
    42     args['error'] = err
     54    #args['error'] = err
     55    args['portal_status_message'] = err
    4356    url = "%s?%s" % (context.absolute_url(),urlencode(args))
    4457    return request.RESPONSE.redirect(url)
     58
     59
    4560cr_id = context.invokeFactory('StudentCourseResult',course_id)
    4661#set_trace()
     
    5065context.portal_workflow.doActionFor(cr,'close')
    5166args['course_id'] = course_id
    52 from urllib import urlencode
    53 url = "%s?%s" % (context.absolute_url(),urlencode(args))
    54 return request.RESPONSE.redirect(url)
    5567
     68logger.info('%s added StudentCourseResult object %s' % (member,course_id))
     69
     70args = {}
     71psm = "You successfully added course %s!" % course_id
     72args['portal_status_message'] = psm
     73url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
     74return REQUEST.RESPONSE.redirect(url)
     75
Note: See TracChangeset for help on using the changeset viewer.