Last change
on this file since 9093 was
5507,
checked in by Henrik Bettermann, 14 years ago
|
more comfortable than using close.py with transition parameter
|
-
Property svn:keywords set to
Id
|
File size:
1.0 KB
|
Rev | Line | |
---|
[5507] | 1 | ## Script (Python) "open" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=REQUEST,transition='open' |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: open.py 5507 2010-08-28 06:39:05Z henrik $ |
---|
| 11 | """ |
---|
| 12 | opens 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.open') |
---|
| 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.