source: WAeUP_SRP/trunk/skins/waeup_student/validate_courses.py @ 16680

Last change on this file since 16680 was 1853, checked in by Henrik Bettermann, 17 years ago

PIN search results showed wrong link

File size: 1.5 KB
RevLine 
[1571]1## Script (Python) "validate_courses"
[1513]2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
[1586]6##bind subpath=traverse_subpath
[1853]7##parameters=student=None, action_after_reject=None, action_after_validate=''
[1513]8##title=
9##
10# $Id: getStudyCourseInfo.py 1504 2007-02-26 21:20:40Z henrik $
11"""
12close the Students StudyLevel
13"""
[1589]14from Products.CMFCore.WorkflowCore import WorkflowException
[1612]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
[1571]28logger = logging.getLogger('Skins.validate_courses')
[1513]29
30wftool = context.portal_workflow
31students_folder = context.portal_url.getPortalObject().campus.students
[1589]32student_id = context.getStudentId()
33student = getattr(students_folder,student_id)
[1612]34level_doc = context.getContent()
35if level_doc.portal_type == 'StudentStudyLevel':
36    level_doc.edit(mapping={'validated_by': member_id,
37                            'validation_date': current,})
[1589]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))
[1575]44
45psm = 'portal_status_message=Course list validated!'
[1588]46url = context.absolute_url() + '/' + action_after_validate +  '?' + psm
[1575]47return request.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.