Logo Search packages:      
Sourcecode: zope-cmfplacefulworkflow version File versions  Download package

def CMFPlacefulWorkflow::DefaultWorkflowPolicy::DefaultWorkflowPolicyDefinition::manage_changeWorkflows (   self,
  title,
  description,
  default_chain,
  props = None,
  REQUEST = None 
)
Changes which workflows apply to objects of which type.

Definition at line 139 of file DefaultWorkflowPolicy.py.

                                                                                                 :
        """ Changes which workflows apply to objects of which type.
        """
        self.title = title
        self.description = description

        wf_tool = getToolByName(self, 'portal_workflow')

        if props is None:
            props = REQUEST
        cbt = self._chains_by_type
        if cbt is None:
            self._chains_by_type = cbt = PersistentMapping()
        ti = self._listTypeInfo()
        # Set up the chains by type.
        for t in ti:
            id = t.getId()
            field_name = 'chain_%s' % id
            chain = props.get(field_name, DEFAULT_CHAIN).strip()
            if chain == DEFAULT_CHAIN:
                # Remove from cbt.
                if cbt.has_key(id):
                    del cbt[id]
            else:
                chain = chain.replace(',', ' ')
                ids = []
                for wf_id in chain.split(' '):
                    if wf_id:
                        if not wf_tool.getWorkflowById(wf_id):
                            raise ValueError, (
                                '"%s" is not a workflow ID.' % wf_id)
                        ids.append(wf_id)
                cbt[id] = tuple(ids)
        # Set up the default chain.
        default_chain = default_chain.replace(',', ' ')
        ids = []
        for wf_id in default_chain.split(' '):
            if wf_id:
                if not wf_tool.getWorkflowById(wf_id):
                    raise ValueError, (
                        '"%s" is not a workflow ID.' % wf_id)
                ids.append(wf_id)
        self._default_chain = tuple(ids)
        if REQUEST is not None:
            return self.manage_selectWorkflows(REQUEST,
                            manage_tabs_message='Changed.')


Generated by  Doxygen 1.6.0   Back to index