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

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

PIN search results showed wrong link

File size: 1.5 KB
Line 
1## Script (Python) "validate_courses"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=student=None, action_after_reject=None, action_after_validate=''
8##title=
9##
10# $Id: getStudyCourseInfo.py 1504 2007-02-26 21:20:40Z henrik $
11"""
12close the Students StudyLevel
13"""
14from Products.CMFCore.WorkflowCore import WorkflowException
15import DateTime
16current = DateTime.DateTime()
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
28logger = logging.getLogger('Skins.validate_courses')
29
30wftool = context.portal_workflow
31students_folder = context.portal_url.getPortalObject().campus.students
32student_id = context.getStudentId()
33student = getattr(students_folder,student_id)
34level_doc = context.getContent()
35if level_doc.portal_type == 'StudentStudyLevel':
36    level_doc.edit(mapping={'validated_by': member_id,
37                            'validation_date': current,})
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.