b8818d0a640c8e13cd0c765b0c1025085165db32
1 ## Script (Python) "content_status_modify"
2 ##parameters=workflow_action, REQUEST=None, **kw
3 ##title=Modify the status of a content object
5 from ZTUtils
import make_query
as mq
6 from Products
.CMFCore
.utils
import getToolByName
7 from Products
.CMFCore
.exceptions
import zExceptions_Unauthorized
9 wftool
= getToolByName(context
, 'portal_workflow')
10 mtool
= getToolByName(context
, 'portal_membership')
11 utool
= getToolByName(context
, 'portal_url')
14 kw
.update(REQUEST
.form
)
17 target
= context
.getActionInfo('object/history')['url']
19 target
= context
.getActionInfo('object/view')['url']
21 res
= wftool
.doActionFor(context
, workflow_action
, **kw
)
23 # by (Plinn) convention
24 # occurs when a ObjectMoved is raised
25 kw
.update({'syncFragments' : ['Breadcrumbs', 'rightCell']})
26 return REQUEST
.RESPONSE
.redirect('%s?%s' % (res
.absolute_url(), mq(**kw
)))
29 kw
.update({'portal_status_message' : 'Status changed.'})
30 try : context
.id # touch something in context
31 except zExceptions_Unauthorized
: target
= utool()
32 return REQUEST
.RESPONSE
.redirect('%s?%s' % (target
, mq(**kw
)))