Commit 5eba4b52 authored by wenjie.zheng's avatar wenjie.zheng Committed by Sebastien Robin

Base.py: replace 'split' with delicate methods.

parent 63e1a0b3
...@@ -680,7 +680,7 @@ def initializePortalTypeERP5WorkflowMethod(ptype_klass, portal_workflow): ...@@ -680,7 +680,7 @@ def initializePortalTypeERP5WorkflowMethod(ptype_klass, portal_workflow):
transition_id_list = [] #ERP5Workflow.objectIds(portal_type='Transition') transition_id_list = [] #ERP5Workflow.objectIds(portal_type='Transition')
transition_list = ERP5Workflow.objectValues(portal_type='Transition') transition_list = ERP5Workflow.objectValues(portal_type='Transition')
for tr in transition_list: for tr in transition_list:
transition_id_list.append('_'.join(tr.getId().split('_')[1:]))### getRef, this id list is actually a reference list transition_id_list.append(tr.getReference())### getRef, this id list is actually a reference list
LOG(" 686 transition_id_list = '%s'"%transition_id_list, WARNING, " in Base.py") LOG(" 686 transition_id_list = '%s'"%transition_id_list, WARNING, " in Base.py")
elif workflow_type == 'DCWorkflowDefinition': elif workflow_type == 'DCWorkflowDefinition':
LOG(" 688 Generating methods of DCWorkflow '%s'"%ERP5Workflow_id, WARNING, " in Base.py") LOG(" 688 Generating methods of DCWorkflow '%s'"%ERP5Workflow_id, WARNING, " in Base.py")
...@@ -697,7 +697,7 @@ def initializePortalTypeERP5WorkflowMethod(ptype_klass, portal_workflow): ...@@ -697,7 +697,7 @@ def initializePortalTypeERP5WorkflowMethod(ptype_klass, portal_workflow):
transition_id_list = [] transition_id_list = []
transition_list = ERP5Workflow.objectValues(portal_type='Interaction') transition_list = ERP5Workflow.objectValues(portal_type='Interaction')
for tr in transition_list: for tr in transition_list:
transition_id_list.append('_'.join(tr.getId().split('_')[1:])) # remove suffinx transition_id_list.append(tr.getReference()) # remove suffinx
LOG(" 703 transition_id_list = '%s'"%transition_id_list, WARNING, ' in Base.py') LOG(" 703 transition_id_list = '%s'"%transition_id_list, WARNING, ' in Base.py')
elif workflow_type == 'InteractionWorkflowDefinition': elif workflow_type == 'InteractionWorkflowDefinition':
LOG(" 705 Generating methods of DC Interaction Workflow '%s'"%ERP5Workflow_id, WARNING, ' in Base.py') LOG(" 705 Generating methods of DC Interaction Workflow '%s'"%ERP5Workflow_id, WARNING, ' in Base.py')
...@@ -716,7 +716,7 @@ def initializePortalTypeERP5WorkflowMethod(ptype_klass, portal_workflow): ...@@ -716,7 +716,7 @@ def initializePortalTypeERP5WorkflowMethod(ptype_klass, portal_workflow):
trigger_dict = {} trigger_dict = {}
for transition in transition_list: for transition in transition_list:
transition_id = transition.getId() transition_id = transition.getReference()
LOG("722 Found transition '%s'"%transition_id,WARNING, " in Base.py") LOG("722 Found transition '%s'"%transition_id,WARNING, " in Base.py")
if transition.trigger_type == TRIGGER_WORKFLOW_METHOD: if transition.trigger_type == TRIGGER_WORKFLOW_METHOD:
LOG("723 Register Trigger by workflow method transition %s"%transition_id,WARNING, " in Base.py") LOG("723 Register Trigger by workflow method transition %s"%transition_id,WARNING, " in Base.py")
...@@ -728,7 +728,7 @@ def initializePortalTypeERP5WorkflowMethod(ptype_klass, portal_workflow): ...@@ -728,7 +728,7 @@ def initializePortalTypeERP5WorkflowMethod(ptype_klass, portal_workflow):
transition_id_set, trigger_dict = v transition_id_set, trigger_dict = v
for tr_id, tdef in trigger_dict.iteritems(): for tr_id, tdef in trigger_dict.iteritems():
LOG("733 processing transition '%s' of '%s'"%(tr_id,ERP5Workflow_id), WARNING, "in Base.py") LOG("733 processing transition '%s' of '%s'"%(tr_id,ERP5Workflow_id), WARNING, "in Base.py")
method_id = convertToMixedCase('_'.join(tr_id.split('_')[1:])) method_id = convertToMixedCase(tr_id)
LOG(" 731 register transition '%s' as method '%s'"%(tr_id, method_id), WARNING, " in Base.py") LOG(" 731 register transition '%s' as method '%s'"%(tr_id, method_id), WARNING, " in Base.py")
try: try:
method = getattr(ptype_klass, method_id) method = getattr(ptype_klass, method_id)
...@@ -3091,7 +3091,7 @@ class Base( CopyContainer, ...@@ -3091,7 +3091,7 @@ class Base( CopyContainer,
for workflow_id in self.getTypeInfo().getTypeERP5WorkflowList(): for workflow_id in self.getTypeInfo().getTypeERP5WorkflowList():
workflow = self.getPortalObject().portal_workflow._getOb(workflow_id) workflow = self.getPortalObject().portal_workflow._getOb(workflow_id)
if workflow.getPortalType() == 'Workflow': if workflow.getPortalType() == 'Workflow':
result += [('_'.join(workflow_id.split('_')[1:]), workflow._getWorkflowStateOf(self, id_only=1))] result += [(workflow.getReference(), workflow._getWorkflowStateOf(self, id_only=1))]
LOG(" 3093 Workflow History result is '%s'"%result, WARNING, " in Base.py") LOG(" 3093 Workflow History result is '%s'"%result, WARNING, " in Base.py")
return result return result
......
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