Commit e1c6bea4 authored by iv's avatar iv

ERP5Workflow: fix more uncorrectly named method (changed List to Dict)

parent f64bbdd2
......@@ -26,7 +26,7 @@ def get_obj_and_reference_list(business_field):
wf = getattr(portal_workflow, wf_id)
if getattr(wf, "interactions", marker) is marker: # only way to make sure it is not an interaction workflow ?
result.append((wf, wf_id, 'workflow'))
for state_id, state in wf.getStateValueList().items():
for state_id, state in wf.getStateValueDict().items():
result.append((state, state_id, 'state'))
for trans_id, trans in wf.getTransitionValueDict().items():
result.append((trans, trans_id, 'transition'))
......
......@@ -26,7 +26,7 @@ def get_obj_and_reference_list(business_field):
wf = getattr(portal_workflow, wf_id)
if getattr(wf, "interactions", marker) is marker: # only way to make sure it is not an interaction workflow ?
result.append((wf, wf_id, 'workflow'))
for state_id, state in wf.getStateValueList().items():
for state_id, state in wf.getStateValueDict().items():
result.append((state, state_id, 'state'))
for trans_id, trans in wf.getTransitionValueDict().items():
result.append((trans, trans_id, 'transition'))
......
......@@ -107,7 +107,7 @@ for i in page_template_list:
s_title_list = []
for i in context.portal_workflow.objectValues():
add_message(i.title_or_id(), portal_url.getRelativeContentURL(i))
state_value_dict = i.getStateValueList()
state_value_dict = i.getStateValueDict()
if not state_value_dict:
continue
for s_id, s in state_value_dict.items():
......
......@@ -65,7 +65,7 @@ if position_graph:\n
\n
def getWorkflowGraph(workflow):\n
graph = dict(node=dict(), edge=dict())\n
for state_id, state in workflow.getStateValueList().iteritems():\n
for state_id, state in workflow.getStateValueDict().iteritems():\n
is_initial_state = state.getId() == workflow.getSourceId()\n
transition_id_list = []\n
graph[\'node\'][state.getId()] = dict(\n
......
......@@ -773,7 +773,7 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
def getStateList(group):
state_dict = {}
for wf in self.portal_workflow.objectValues():
state_list = wf.getStateValueList()
state_list = wf.getStateValueDict()
for state_id in state_list:
state = state_list[state_id]
if group in getattr(state, 'type_list', ()):
......@@ -1300,8 +1300,8 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
def getStateList():
state_dict = {}
for wf in self.portal_workflow.objectValues():
if wf.getVariableValueList() and wf.getStateVariable() == 'simulation_state':
state_list = wf.getStateValueList()
if wf.getVariableValueDict() and wf.getStateVariable() == 'simulation_state':
state_list = wf.getStateValueDict()
for state_id in state_list:
state = state_list[state_id]
if getattr(state, 'type_list', None):
......
......@@ -40,7 +40,7 @@ for history_name in ['history', 'building_history', 'installation_history']:
workflow = getattr(portal_workflow, workflow_id)
wf_state_var = workflow.getStateVariable()
wf_states = workflow.getStateValueList()
wf_states = workflow.getStateValueDict()
wf_transitions = workflow.getTransitionValueDict()
next_serial = None
......
......@@ -11,7 +11,7 @@ state_dict = {}
item_list = []
for workflow_id in workflow_id_list:
workflow = getToolByName(context, 'portal_workflow')[workflow_id]
for state_id, state in workflow.getStateValueList().items():
for state_id, state in workflow.getStateValueDict().items():
if state.title and state_id!='deleted':
if not state_dict.has_key(state_id):
# we hide states without titles
......
......@@ -183,7 +183,7 @@ for folder in context.portal_skins.objectValues(spec=('Folder',)):
for wf in context.portal_workflow.objectValues():
# Test workflow states
wf_states = wf.getStateValueList()
wf_states = wf.getStateValueDict()
message = ''
if wf_states not in (None, (), [], ''):
for state_id in wf_states.keys():
......
......@@ -34,15 +34,15 @@ for portal_type in portal_type:
workflow = workflow_tool[workflow_id]
# skip interaction workflows or workflows with only one state (such as edit_workflow)
if workflow.getStateValueList() is None or len(workflow.getStateIdList()) <= 1:
if workflow.getStateValueDict() is None or len(workflow.getStateIdList()) <= 1:
continue
# skip workflows using another state variable
if state_var not in (None, workflow.getStateVariable()):
continue
for state_id in workflow.getStateValueList():
state = workflow.getStateValueList().get(state_id)
for state_id in workflow.getStateValueDict():
state = workflow.getStateValueDict().get(state_id)
if state_id in state_set:
continue
state_set.add(state_id)
......
......@@ -32,8 +32,8 @@ for portal_type in portal_type_list:
if wf is None:
continue
state_var = wf.getStateVariable()
if wf.getStateValueList():
state_value_list = wf.getStateValueList()
if wf.getStateValueDict():
state_value_list = wf.getStateValueDict()
for state_ref, state in state_value_list.items():
for lang in supported_languages:
key = (lang, pt_id, state_var, state_ref)
......
......@@ -12,7 +12,7 @@ for portal_type in context.allowedContentTypes():
portal_type_id = portal_type.getId()
portal_type_translated_title_dict[portal_type_id] = translateString(portal_type.getTitle())
for workflow in getWorkflowsFor(portal_type_id):
state_container = workflow.getStateValueList()
state_container = workflow.getStateValueDict()
if state_container is not None and len(state_container) > 1:
state_var = workflow.getStateVariable()
if state_var is None:
......
......@@ -2742,7 +2742,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
Make sure that changing workflow state after delivered changes
records in stock table.
"""
delivered_state = self.portal.portal_workflow.inventory_workflow.getStateValueList()['delivered']
delivered_state = self.portal.portal_workflow.inventory_workflow.getStateValueDict()['delivered']
delivered_state.addPossibleTransition('cancel')
self.commit()
......
......@@ -88,7 +88,7 @@ class WorkflowSecurityConfiguratorItem(ConfiguratorItemMixin, XMLObject):
state_list = table_dict['state']
for state_config in state_list:
state_id = state_config.pop('state')
state = workflow.getStateValueList()[state_id]
state = workflow.getStateValueDict()[state_id]
# Clean the state matrix
for permission in permission_list:
state.setPermission(permission, 0, [])
......
......@@ -328,8 +328,8 @@ def getSearchDialog(self, REQUEST=None):
continue
workflow_set.add(state_var)
if workflow.getStateValueList() is None or \
len(workflow.getStateValueList()) <= 1:
if workflow.getStateValueDict() is None or \
len(workflow.getStateValueDict()) <= 1:
continue
field_id = 'your_%s' % state_var
......@@ -340,7 +340,7 @@ def getSearchDialog(self, REQUEST=None):
form_id='Base_viewDialogFieldLibrary',
field_id='your_category_list'))
items = sorted([(translateString(x.title), x.id) for x_ref, x
in workflow.getStateValueList().items()],
in workflow.getStateValueDict().items()],
key=lambda x:str(x[0]))
field._surcharged_edit(
dict(title=translateString(workflow.title),
......
......@@ -792,7 +792,7 @@ def DCWorkflowDefinition_notifySuccess(self, ob, transition_list, result, args=N
pass
# following 15 patches are required for the new workflow tool compatibility.
def DCWorkflowDefinition_getVariableValueList(self):
def DCWorkflowDefinition_getVariableValueDict(self):
if self.variables is not None:
return self.variables
return {}
......@@ -802,7 +802,7 @@ def DCWorkflowDefinition_getVariableIdList(self):
return []
def DCWorkflowDefinition_getStateVariable(self):
return self.state_var
def DCWorkflowDefinition_getStateValueList(self):
def DCWorkflowDefinition_getStateValueDict(self):
if self.states is not None:
return self.states
return {}
......@@ -1084,8 +1084,8 @@ DCWorkflowDefinition.getSourceValue = DCWorkflowDefinition_getSourceValue
DCWorkflowDefinition.notifyWorkflowMethod = DCWorkflowDefinition_notifyWorkflowMethod
DCWorkflowDefinition.notifyBefore = DCWorkflowDefinition_notifyBefore
DCWorkflowDefinition.notifySuccess = DCWorkflowDefinition_notifySuccess
DCWorkflowDefinition.getVariableValueList = DCWorkflowDefinition_getVariableValueList
DCWorkflowDefinition.getStateValueList = DCWorkflowDefinition_getStateValueList
DCWorkflowDefinition.getVariableValueDict = DCWorkflowDefinition_getVariableValueDict
DCWorkflowDefinition.getStateValueDict = DCWorkflowDefinition_getStateValueDict
DCWorkflowDefinition.getTransitionValueDict = DCWorkflowDefinition_getTransitionValueDict
DCWorkflowDefinition.getWorklistValueDict = DCWorkflowDefinition_getWorklistValueDict
DCWorkflowDefinition.getScriptValueDict = DCWorkflowDefinition_getScriptValueDict
......
......@@ -970,7 +970,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self.getWorkflowTool().getWorkflowValueListFor('Person'))
self.assertEqual('validation_state', wf.getStateVariable())
initial_state = wf.getSourceValue()
other_state = wf.getStateValueList()['validated']
other_state = wf.getStateValueDict()['validated']
self.assertTrue(hasattr(person, 'getValidationState'))
self.assertTrue(hasattr(person, 'getValidationStateTitle'))
......
......@@ -118,7 +118,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
'''
Returns a true value if the given info name is supported.
'''
vdef = self.getVariableValueList().get(name, None)
vdef = self.getVariableValueDict().get(name, None)
if vdef is None:
return 0
return 1
......@@ -367,7 +367,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
return 1
return 0
def getStateValueList(self):
def getStateValueDict(self):
return {}
def showAsXML(self, root=None):
......
......@@ -196,7 +196,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
'''
if name == self.getStateVariable():
return 1
vdef = self.getVariableValueList().get(name, None)
vdef = self.getVariableValueDict().get(name, None)
if vdef is None:
return 0
return 1
......@@ -424,7 +424,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
'''
if name == self.getStateVariable():
return self._getWorkflowStateOf(ob, 1)
vdef = self.getVariableValueList()[name]
vdef = self.getVariableValueDict()[name]
if vdef.getInfoGuard() is not None and not vdef.getInfoGuard().check(
getSecurityManager(), self, ob):
return default
......@@ -478,7 +478,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
else:
return state
def getVariableValueList(self):
def getVariableValueDict(self):
variable_dict = {}
for vdef in self.objectValues(portal_type="Variable"):
variable_dict[vdef.getReference()] = vdef
......@@ -490,7 +490,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
id_list.append(ob.getReference())
return id_list
def getStateValueList(self):
def getStateValueDict(self):
state_dict = {}
for sdef in self.objectValues(portal_type="State"):
state_dict[sdef.getReference()] = sdef
......@@ -1050,13 +1050,13 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
raise WorkflowException, ('Destination state undefined: ' + new_state_id)
# Update variables.
state_values = self.getVariableValueList()
state_values = self.getVariableValueDict()
if state_values is None:
state_values = {}
tdef_exprs = {}
status = {}
for id, vdef in self.getVariableValueList().items():
for id, vdef in self.getVariableValueDict().items():
if vdef.getForStatus() == 0:
continue
expr = None
......@@ -1118,7 +1118,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# Always provide the state variable.
state_var = self.getStateVariable()
status = self.getCurrentStatusDict(ob)
for vdef_ref, vdef in self.getVariableValueList().iteritems():
for vdef_ref, vdef in self.getVariableValueDict().iteritems():
if vdef.getForCatalog():
default_expr = vdef.getDefaultExpr()
if status.has_key(vdef_ref):
......
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