Back to index

plone3  3.1.7
prefs_workflow_policy_mapping_set.py
Go to the documentation of this file.
00001 ##parameters=submit, wfpid, title, description, wf, default_workflow_id
00002 ##title=set local workflow policy mapping
00003 #-*- coding: utf-8 -*-
00004 
00005 from Products.CMFCore.utils import getToolByName
00006 from Products.CMFPlacefulWorkflow import CMFPlacefulWorkflowMessageFactory as _
00007 
00008 request = context.REQUEST
00009 policy = getToolByName(context, 'portal_placeful_workflow').getWorkflowPolicyById(wfpid)
00010 
00011 policy.setTitle(title)
00012 policy.setDescription(description)
00013 
00014 policy.setDefaultChain(default_chain=(default_workflow_id,),REQUEST=context.REQUEST)
00015 
00016 for pt, wf in wf.items():
00017     policy.setChain(portal_type=pt, chain=(wf,),REQUEST=context.REQUEST)
00018 
00019 wf_tool = getToolByName(context, 'portal_workflow')
00020 wf_tool.updateRoleMappings()
00021 
00022 context.plone_utils.addPortalMessage(_(u'Changes to criteria saved.'))
00023 if request:
00024     request.RESPONSE.redirect('prefs_workflow_policy_mapping?wfpid=%s' % wfpid)
00025 
00026 return request