Commit 456f4d6c authored by wenjie.zheng's avatar wenjie.zheng

WorkflowTool.py: remove default variables and state added by pre configuration...

WorkflowTool.py: remove default variables and state added by pre configuration script before convertion.
parent 18169982
...@@ -279,6 +279,10 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -279,6 +279,10 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
if temp == 0: if temp == 0:
# create transitions # create transitions
if workflow_type_id == 'DCWorkflowDefinition': if workflow_type_id == 'DCWorkflowDefinition':
# remove default state and variables
  • Please always have in mind : is this code beautiful ? Do we have a better way to achieve my goal ?

    Here we have not clean and fragile code. If we change anything in default initialization of workflow, this code would need to be updated. This is very fragile.

    It would be much nicer in the init script of Workflow to do :

    if not(context.isTempObject()):

    set default properties (variable, state, etc)

Please register or sign in to reply
  • In some DC workflow (such as "embedded_workflow"), there is not default state 'draft'; and for some others (like assignment_workflow has 6 variables) they don't have all 7 variables we defined in default workflow. So when we converted the DC workflow, it's better to remove all pre configured objects and converted from DC workflow than modifier one by one in specific case.

Please register or sign in to reply
for def_var in workflow.objectValues(portal_type='Variable'):
workflow._delObject(def_var.getId())
workflow._delObject('state_draft')
for tid in dc_workflow.transitions: for tid in dc_workflow.transitions:
tdef = dc_workflow.transitions.get(tid) tdef = dc_workflow.transitions.get(tid)
transition = workflow.newContent(portal_type='Transition', temp_object=temp) transition = workflow.newContent(portal_type='Transition', temp_object=temp)
......
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