source: WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/register_courses.py @ 4070

Last change on this file since 4070 was 1597, checked in by joachim, 18 years ago

merged changes 1588:1596 from trunk to joachim-event-branch

File size: 1.6 KB
RevLine 
[1596]1## Script (Python) "register_courses"
[1513]2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
[1597]7##parameters=REQUEST=None, 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"""
12close the Students StudyLevel
13"""
[1596]14from Products.CMFCore.WorkflowCore import WorkflowException
[1513]15try:
16    from Products.zdb import set_trace
17except:
18    def set_trace():
19        pass
20
[1597]21from urllib import urlencode       
22
[1513]23request = context.REQUEST
24mtool = context.portal_membership
25member = mtool.getAuthenticatedMember()
26member_id = str(member)
27import logging
[1596]28logger = logging.getLogger('Skins.register_courses')
[1513]29
30wftool = context.portal_workflow
31students_folder = context.portal_url.getPortalObject().campus.students
[1596]32student_id = context.getStudentId()
33student = getattr(students_folder,student_id)
34try:
35    wftool.doActionFor(context,'close')
36except WorkflowException,E:
37    logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id))
38    return request.RESPONSE.redirect("%s" % context.absolute_url())
39try:
40    wftool.doActionFor(student,'register_courses')
41except WorkflowException,E:
42    logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id))
43    return request.RESPONSE.redirect("%s" % context.absolute_url())
[1597]44logger.info('%s registered course list of %s' % (member_id,student_id))
45
46args = {}
47psm = "You successfully submitted your course list!"
48args['portal_status_message'] = psm
49url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
50return REQUEST.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.