source: WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py @ 9819

Last change on this file since 9819 was 1653, checked in by uli, 18 years ago

Incorporated changeset 1593:1652 of trunk into uli-branch.

File size: 1.5 KB
RevLine 
[1593]1## Script (Python) "validate_courses"
[1513]2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
[1593]7##parameters=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"""
[1593]14from Products.CMFCore.WorkflowCore import WorkflowException
[1653]15import DateTime
16current = DateTime.DateTime()
[1513]17try:
18    from Products.zdb import set_trace
19except:
20    def set_trace():
21        pass
22
23request = context.REQUEST
24mtool = context.portal_membership
25member = mtool.getAuthenticatedMember()
26member_id = str(member)
27import logging
[1593]28logger = logging.getLogger('Skins.validate_courses')
[1513]29
30wftool = context.portal_workflow
31students_folder = context.portal_url.getPortalObject().campus.students
[1593]32student_id = context.getStudentId()
33student = getattr(students_folder,student_id)
[1653]34level_doc = context.getContent()
35if level_doc.portal_type == 'StudentStudyLevel':
36    level_doc.edit(mapping={'validated_by': member_id,
37                            'validation_date': current,})
[1593]38try:
39    wftool.doActionFor(student,'validate_courses')
40except WorkflowException,E:
41    logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id))
42    return request.RESPONSE.redirect("%s" % context.absolute_url())
43logger.info('%s validated course list of %s' % (member_id,student_id))
44
45psm = 'portal_status_message=Course list validated!'
46url = context.absolute_url() + '/' + action_after_validate +  '?' + psm
47return request.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.