source: WAeUP_SRP/trunk/skins/waeup_utilities/close.py @ 4331

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

fix interswitch_acco_cb.py

add simple scrip to close objects

File size: 1.1 KB
Line 
1## Script (Python) "close"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=REQUEST,transition='close'
8##title=
9##
10# $Id: close.py 1348 2007-01-25 17:06:21Z henrik $
11"""
12closes object
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.close')
26
27pm = context.portal_membership
28member = pm.getAuthenticatedMember()
29
30request = context.REQUEST
31wftool = context.portal_workflow
32try:
33    wftool.doActionFor(context,transition)
34    logger.info('%s executed transition %s for %s' % (member,transition,context.getId()))
35except:
36    logger.info('%s tried to execute transition %s for %s, transition not allowed' % (member,transition,context.getId()))
37    return 'Transition not allowed!'
38
39return request.RESPONSE.redirect("%s" % context.absolute_url())
Note: See TracBrowser for help on using the repository browser.