def add_worklists(self): wft = getToolByName(self, 'portal_workflow') for wf in wft.objectValues(): if not IWorkflowDefinition.providedBy(wf): continue if not getattr(wf, 'worklists', None): wf._addObject(Worklists('worklists'))
def getWorkflowIds(self): """ Return the list of workflow ids. """ wf_ids = [] for obj_name, obj in self.objectItems(): if IWorkflowDefinition.providedBy(obj): wf_ids.append(obj_name) return tuple(wf_ids)
def getWorkflowById(self, wf_id): """ Retrieve a given workflow. """ wf = getattr(self, wf_id, None) if IWorkflowDefinition.providedBy(wf): return wf else: return None
def check_workflow_definitions(tool): """2.1.x to 2.2.0 upgrade step checker """ wtool = getToolByName(tool, 'portal_workflow') for obj in wtool.objectValues(): if IWorkflowDefinition.providedBy(obj): for t in obj.transitions.values(): if not t.actbox_icon and t.getId() in _ACTION_ICONS: return True for w in obj.worklists.values(): if not w.actbox_icon and w.getId() in _ACTION_ICONS: return True return False
def getWorkflowById(self, wf_id): """ Retrieve a given workflow. """ wf = getattr(self, wf_id, None) if IWorkflowDefinition.providedBy(wf): return wf if getattr(wf, '_isAWorkflow', False): # BBB warn("The '_isAWorkflow' marker attribute for workflow " "definitions is deprecated and will be removed in " "CMF 2.3; please mark the definition with " "'IWorkflowDefinition' instead.", DeprecationWarning, stacklevel=2) return wf else: return None
def getWorkflowById(self, wf_id): """ Retrieve a given workflow. """ wf = getattr(self, wf_id, None) if IWorkflowDefinition.providedBy(wf): return wf if getattr(wf, '_isAWorkflow', False): # BBB warn( "The '_isAWorkflow' marker attribute for workflow " "definitions is deprecated and will be removed in " "CMF 2.3; please mark the definition with " "'IWorkflowDefinition' instead.", DeprecationWarning, stacklevel=2) return wf else: return None
def getWorkflowIds(self): """ Return the list of workflow ids. """ wf_ids = [] for obj_name, obj in self.objectItems(): if IWorkflowDefinition.providedBy(obj): wf_ids.append(obj_name) elif getattr(obj, '_isAWorkflow', 0): # BBB warn("The '_isAWorkflow' marker attribute for workflow " "definitions is deprecated and will be removed in " "CMF 2.3; please mark the definition with " "'IWorkflowDefinition' instead.", DeprecationWarning, stacklevel=2) wf_ids.append(obj_name) return tuple(wf_ids)
def upgrade_workflow_definitions(tool): """2.1.x to 2.2.0 upgrade step handler """ logger = logging.getLogger('GenericSetup.upgrade') wtool = getToolByName(tool, 'portal_workflow') for wf in wtool.objectValues(): changed = False if IWorkflowDefinition.providedBy(wf): for t in wf.transitions.values(): if not t.actbox_icon and t.getId() in _ACTION_ICONS: icon = _ACTION_ICONS[t.getId()] t.actbox_icon = '%(portal_url)s/' + icon changed = True for w in wf.worklists.values(): if not w.actbox_icon and w.getId() in _ACTION_ICONS: icon = _ACTION_ICONS[w.getId()] w.actbox_icon = '%(portal_url)s/' + icon changed = True if changed: logger.info("WorkflowDefinition '%s' changed." % wf.getId())
def getWorkflowIds(self): """ Return the list of workflow ids. """ wf_ids = [] for obj_name, obj in self.objectItems(): if IWorkflowDefinition.providedBy(obj): wf_ids.append(obj_name) elif getattr(obj, '_isAWorkflow', 0): # BBB warn( "The '_isAWorkflow' marker attribute for workflow " "definitions is deprecated and will be removed in " "CMF 2.3; please mark the definition with " "'IWorkflowDefinition' instead.", DeprecationWarning, stacklevel=2) wf_ids.append(obj_name) return tuple(wf_ids)