Commit 70c35728 authored by wenjie.zheng's avatar wenjie.zheng Committed by Sebastien Robin

WorkflowTool.py: add workflow_script reference in conversion codes; add a...

WorkflowTool.py: add workflow_script reference in conversion codes; add a chains_by_type repair script related function.
parent affb6a8d
...@@ -275,6 +275,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -275,6 +275,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
def dc_workflow_asERP5Object(self, container, dc_workflow, temp): def dc_workflow_asERP5Object(self, container, dc_workflow, temp):
# create a temporary ERP5 Workflow # create a temporary ERP5 Workflow
# instead of adding prefix toavoid id conflict, prefer to put dcworkflow in portal_trash;
workflow_type_id = dc_workflow.__class__.__name__ workflow_type_id = dc_workflow.__class__.__name__
if workflow_type_id == 'DCWorkflowDefinition': if workflow_type_id == 'DCWorkflowDefinition':
LOG("2.a Workflow '%s' is a DCWorkflow'"%dc_workflow.id,WARNING,' in WorkflowTool.py') LOG("2.a Workflow '%s' is a DCWorkflow'"%dc_workflow.id,WARNING,' in WorkflowTool.py')
...@@ -442,6 +443,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -442,6 +443,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
workflow_script = workflow.newContent(id='script_'+script_id ,portal_type='Workflow Script', temp_object=temp) workflow_script = workflow.newContent(id='script_'+script_id ,portal_type='Workflow Script', temp_object=temp)
LOG("2.5 Convert workflow script '%s' of workflow '%s'"%(workflow_script.id,workflow.getTitle()),WARNING,' in WorkflowTool.py') LOG("2.5 Convert workflow script '%s' of workflow '%s'"%(workflow_script.id,workflow.getTitle()),WARNING,' in WorkflowTool.py')
workflow_script.edit(title=script.title) workflow_script.edit(title=script.title)
workflow_script.default_reference = script_id
workflow_script.setParameterSignature(script._params) workflow_script.setParameterSignature(script._params)
#workflow_script.setCallableType(script.callable_type)# not defined in python script? #workflow_script.setCallableType(script.callable_type)# not defined in python script?
workflow_script.setBody(script._body) workflow_script.setBody(script._body)
...@@ -630,6 +632,10 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -630,6 +632,10 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
type_workflow_dict.setdefault(type_id, []).append(workflow_id_list) type_workflow_dict.setdefault(type_id, []).append(workflow_id_list)
return type_workflow_dict return type_workflow_dict
# For Chains By Type Repair Tool:
def addTypeCBT(self, pt, wf_id):
self._chains_by_type[pt] = self._chains_by_type[pt] + (wf_id, )
def delTypeCBT(self, pt, wf_id): def delTypeCBT(self, pt, wf_id):
self._chains_by_type[pt] = tuple(wf for wf in self._chains_by_type[pt] if wf != wf_id) self._chains_by_type[pt] = tuple(wf for wf in self._chains_by_type[pt] if wf != wf_id)
......
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