source: WAeUP_SRP/base/skins/waeup_utilities/changeRegState.py @ 3356

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

install button to execute transitions return and pay_school_fee

File size: 1.3 KB
Line 
1## Script (Python) "changeRegState"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=REQUEST,transition=None
8##title=
9##
10# $Id: epayment_cb.py 1348 2007-01-25 17:06:21Z henrik $
11"""
12execute transition
13"""
14
15mtool = context.portal_membership
16member = mtool.getAuthenticatedMember()
17
18#if str(member) not in ('admin','joachim') or transition is None:
19#    return 'Forbidden!'
20   
21if not context.isSectionOfficer() or transition is None:
22    return 'Forbidden!'   
23
24import logging
25logger = logging.getLogger('Skins.changeRegState')
26
27pm = context.portal_membership
28member = pm.getAuthenticatedMember()
29
30request = context.REQUEST
31students = context.portal_url.getPortalObject().campus.students
32wftool = context.portal_workflow
33student_id = context.getStudentId()
34if student_id is None:
35    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
36
37student = getattr(students,student_id)
38try:
39    wftool.doActionFor(student,transition)
40    logger.info('%s executed transition %s for %s' % (member,transition,student_id))
41except:
42    logger.info('%s tried to execute transition %s for %s, transition not allowed' % (member,transition,student_id))
43    return 'Transition not allowed!'
44
45return request.RESPONSE.redirect("%s" % context.absolute_url())
Note: See TracBrowser for help on using the repository browser.