Back to index

plone3  3.1.7
placeful_workflow_configuration_set.py
Go to the documentation of this file.
00001 ##parameters=policy_in='', policy_below=''
00002 ##title=set placeful workflow configuration
00003 ##
00004 from Products.CMFCore.utils import getToolByName
00005 from Products.CMFPlacefulWorkflow import CMFPlacefulWorkflowMessageFactory as _
00006 
00007 request = context.REQUEST
00008 config = getToolByName(context, 'portal_placeful_workflow').getWorkflowPolicyConfig(context)
00009 
00010 if not config:
00011     message = _(u'No config in this folder.')
00012 else:
00013     if context.portal_placeful_workflow.getWorkflowPolicyById(policy_in):
00014         config.setPolicyIn(policy=policy_in)
00015     elif policy_in == '':
00016         config.setPolicyIn(policy='')
00017     else:
00018         raise str(policy_in)
00019 
00020     if context.portal_placeful_workflow.getWorkflowPolicyById(policy_below):
00021         config.setPolicyBelow(policy=policy_below)
00022     elif policy_below == '':
00023         config.setPolicyBelow(policy='')
00024     else:
00025         raise str(policy_below)
00026 
00027     message = _('Changed policies.')
00028     getToolByName(context, 'portal_workflow').updateRoleMappings()
00029 
00030 context.plone_utils.addPortalMessage(message)
00031 request.RESPONSE.redirect('placeful_workflow_configuration')