Commit 1cc48658 authored by wenjie.zheng's avatar wenjie.zheng

Debugging FunctionalCore and FunctionalKM errors.

parent aac83e25
...@@ -128,7 +128,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -128,7 +128,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
""" """
from Products.ERP5.InteractionWorkflow import InteractionWorkflowDefinition from Products.ERP5.InteractionWorkflow import InteractionWorkflowDefinition
from Products.ERP5Workflow.Document.InteractionWorkflow import InteractionWorkflow from Products.ERP5Workflow.Document.InteractionWorkflow import InteractionWorkflow
workflow_list = self.getWorkflowsFor(ob.getPortalType()) workflow_list = self.getWorkflowValueListFor(ob.getPortalType())
if wf_id is None: if wf_id is None:
if not workflow_list: if not workflow_list:
raise WorkflowException('No workflows found.') raise WorkflowException('No workflows found.')
...@@ -155,7 +155,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -155,7 +155,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
""" """
from Products.ERP5.InteractionWorkflow import InteractionWorkflowDefinition from Products.ERP5.InteractionWorkflow import InteractionWorkflowDefinition
from Products.ERP5Workflow.Document.InteractionWorkflow import InteractionWorkflow from Products.ERP5Workflow.Document.InteractionWorkflow import InteractionWorkflow
for workflow in (wf_id and (self[wf_id],) or self.getWorkflowsFor(ob.getPortalType())): for workflow in (wf_id and (self[wf_id],) or self.getWorkflowValueListFor(ob.getPortalType())):
if not isinstance(workflow, InteractionWorkflowDefinition) and \ if not isinstance(workflow, InteractionWorkflowDefinition) and \
not isinstance(workflow, InteractionWorkflow): not isinstance(workflow, InteractionWorkflow):
if state_id in workflow.getStateIdList(): if state_id in workflow.getStateIdList():
...@@ -163,7 +163,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -163,7 +163,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
return False return False
def doActionFor(self, ob, action, wf_id=None, *args, **kw): def doActionFor(self, ob, action, wf_id=None, *args, **kw):
workflow_list = self.getWorkflowsFor(ob.getPortalType()) workflow_list = self.getWorkflowValueListFor(ob.getPortalType())
action_ref = action action_ref = action
if wf_id is None: if wf_id is None:
if workflow_list == []: if workflow_list == []:
...@@ -214,7 +214,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -214,7 +214,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
workflow_list.append(wf) workflow_list.append(wf)
return workflow_list return workflow_list
getWorkflowsFor = getWorkflowValueListFor #getWorkflowsFor = getWorkflowValueListFor
def getHistoryOf(self, wf_id, ob): def getHistoryOf(self, wf_id, ob):
""" Get the history of an object for a given workflow. """ Get the history of an object for a given workflow.
...@@ -529,7 +529,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -529,7 +529,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
def isTransitionPossible(self, ob, transition_id, wf_id=None): def isTransitionPossible(self, ob, transition_id, wf_id=None):
"""Test if the given transition exist from the current state. """Test if the given transition exist from the current state.
""" """
for workflow in (wf_id and (self[wf_id],) or self.getWorkflowsFor(ob.getPortalType())): for workflow in (wf_id and (self[wf_id],) or self.getWorkflowValueListFor(ob.getPortalType())):
state = workflow._getWorkflowStateOf(ob) state = workflow._getWorkflowStateOf(ob)
if state and transition_id in state.getDestinationReferenceList(): if state and transition_id in state.getDestinationReferenceList():
return 1 return 1
......
...@@ -507,7 +507,7 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow): ...@@ -507,7 +507,7 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
workflow_dict = {} workflow_dict = {}
interaction_workflow_dict = {} interaction_workflow_dict = {}
for wf in portal_workflow.getWorkflowsFor(portal_type): for wf in portal_workflow.getWorkflowValueListFor(portal_type):
wf_id = wf.getId() wf_id = wf.getId()
wf_type = wf.__class__.__name__ wf_type = wf.__class__.__name__
if wf_type == "DCWorkflowDefinition" or wf_type == "Workflow": if wf_type == "DCWorkflowDefinition" or wf_type == "Workflow":
...@@ -2687,7 +2687,7 @@ class Base( CopyContainer, ...@@ -2687,7 +2687,7 @@ class Base( CopyContainer,
'isDeleted') 'isDeleted')
def isDeleted(self): def isDeleted(self):
"""Test if the context is in 'deleted' state""" """Test if the context is in 'deleted' state"""
for wf in self.getPortalObject().portal_workflow.getWorkflowsFor(self): for wf in self.getPortalObject().portal_workflow.getWorkflowValueListFor(self):
state = wf._getWorkflowStateOf(self) state = wf._getWorkflowStateOf(self)
if state is not None and state.getReference() == 'deleted': if state is not None and state.getReference() == 'deleted':
return True return True
...@@ -2729,7 +2729,7 @@ class Base( CopyContainer, ...@@ -2729,7 +2729,7 @@ class Base( CopyContainer,
Returns a list of tuples {id:workflow_id, state:workflow_state} Returns a list of tuples {id:workflow_id, state:workflow_state}
""" """
result = [] result = []
for wf in self.portal_workflow.getWorkflowsFor(self.getPortalType()): for wf in self.portal_workflow.getWorkflowValueListFor(self.getPortalType()):
result += [(wf.getReference(), wf._getWorkflowStateOf(self, id_only=1))] result += [(wf.getReference(), wf._getWorkflowStateOf(self, id_only=1))]
return result return result
...@@ -3097,7 +3097,7 @@ class Base( CopyContainer, ...@@ -3097,7 +3097,7 @@ class Base( CopyContainer,
# Check if edit_workflow defined # Check if edit_workflow defined
portal_workflow = self.getPortalObject().portal_workflow portal_workflow = self.getPortalObject().portal_workflow
wf = portal_workflow.getWorkflowById('edit_workflow') wf = portal_workflow.getWorkflowById('edit_workflow')
wf_list = portal_workflow.getWorkflowsFor(self) wf_list = portal_workflow.getWorkflowValueListFor(self)
if wf is not None: if wf is not None:
wf_list = [wf] + wf_list wf_list = [wf] + wf_list
for wf in wf_list: for wf in wf_list:
...@@ -3372,7 +3372,7 @@ class Base( CopyContainer, ...@@ -3372,7 +3372,7 @@ class Base( CopyContainer,
portal = self.getPortalObject() portal = self.getPortalObject()
workflow_tool = portal.portal_workflow workflow_tool = portal.portal_workflow
worflow_variable_list = [] worflow_variable_list = []
for workflow in workflow_tool.getWorkflowsFor(self): for workflow in workflow_tool.getWorkflowValueListFor(self):
if not isinstance(workflow, InteractionWorkflowDefinition) and \ if not isinstance(workflow, InteractionWorkflowDefinition) and \
not isinstance(workflow, InteractionWorkflow): not isinstance(workflow, InteractionWorkflow):
worflow_variable_list.append(self.getProperty(workflow.getStateVariable())) worflow_variable_list.append(self.getProperty(workflow.getStateVariable()))
......
...@@ -427,7 +427,7 @@ class ERP5TypeInformation(XMLObject, ...@@ -427,7 +427,7 @@ class ERP5TypeInformation(XMLObject,
# Unauthorized error on transition's condition # Unauthorized error on transition's condition
workflow_tool = portal.portal_workflow workflow_tool = portal.portal_workflow
if workflow_tool is not None: if workflow_tool is not None:
for workflow in workflow_tool.getWorkflowsFor(ob): for workflow in workflow_tool.getWorkflowValueListFor(ob):
workflow.notifyCreated(ob) workflow.notifyCreated(ob)
if not temp_object: if not temp_object:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment