Last change
on this file since 3339 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
|
Rev | Line | |
---|
[2962] | 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 | """ |
---|
| 12 | closes object |
---|
| 13 | """ |
---|
| 14 | |
---|
| 15 | mtool = context.portal_membership |
---|
| 16 | member = mtool.getAuthenticatedMember() |
---|
| 17 | |
---|
| 18 | #if str(member) not in ('admin','joachim') or transition is None: |
---|
| 19 | # return 'Forbidden!' |
---|
| 20 | |
---|
| 21 | if not context.isSectionOfficer() or transition is None: |
---|
| 22 | return 'Forbidden!' |
---|
| 23 | |
---|
| 24 | import logging |
---|
| 25 | logger = logging.getLogger('Skins.close') |
---|
| 26 | |
---|
| 27 | pm = context.portal_membership |
---|
| 28 | member = pm.getAuthenticatedMember() |
---|
| 29 | |
---|
| 30 | request = context.REQUEST |
---|
| 31 | wftool = context.portal_workflow |
---|
| 32 | try: |
---|
| 33 | wftool.doActionFor(context,transition) |
---|
| 34 | logger.info('%s executed transition %s for %s' % (member,transition,context.getId())) |
---|
| 35 | except: |
---|
| 36 | logger.info('%s tried to execute transition %s for %s, transition not allowed' % (member,transition,context.getId())) |
---|
| 37 | return 'Transition not allowed!' |
---|
| 38 | |
---|
| 39 | return request.RESPONSE.redirect("%s" % context.absolute_url()) |
---|
Note: See
TracBrowser for help on using the repository browser.