Commit 3a692fdf authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use list instead of dict.keys to store unhashable configuration parameters like lists.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33957 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 244f0233
...@@ -97,21 +97,22 @@ class SolverProcess(XMLObject, ActiveProcess): ...@@ -97,21 +97,22 @@ class SolverProcess(XMLObject, ActiveProcess):
for movement in decision.getDeliveryValueList(): for movement in decision.getDeliveryValueList():
# Detect incompatibilities # Detect incompatibilities
movement_solver_dict = movement_dict.setdefault(movement.getRelativeUrl(), {}) movement_solver_dict = movement_dict.setdefault(movement.getRelativeUrl(), {})
movement_solver_configuration_dict = movement_solver_dict.setdefault(solver_type, {}) movement_solver_configuration_list = movement_solver_dict.setdefault(solver_type, [])
movement_solver_configuration_dict[solver_conviguration_key] = None if solver_conviguration_key not in movement_solver_configuration_list:
movement_solver_configuration_list.append(solver_conviguration_key)
# Second, make sure solvers do not conflict and configuration is valid # Second, make sure solvers do not conflict and configuration is valid
# Build a movement and configuration structure per solver type # Build a movement and configuration structure per solver type
solver_dict = {} solver_dict = {}
for movement_url, movement_solver_dict in movement_dict.items(): for movement_url, movement_solver_dict in movement_dict.items():
for solver_type, movement_solver_configuration_dict in movement_solver_dict.items(): for solver_type, movement_solver_configuration_list in movement_solver_dict.items():
solver_movement_dict = solver_dict.setdefault(solver_type, {}) solver_movement_dict = solver_dict.setdefault(solver_type, {})
configuration_list = solver_movement_dict.setdefault(movement_url, []) configuration_list = solver_movement_dict.setdefault(movement_url, [])
configuration_list.extend(movement_solver_configuration_dict) # XXX-JPS WRONG configuration_list.extend(movement_solver_configuration_list) # XXX-JPS WRONG
# Then start the grouping procedure # Then start the grouping procedure
solver_dict = {} solver_dict = {}
for movement_url, movement_solver_dict in movement_dict.items(): for movement_url, movement_solver_dict in movement_dict.items():
for solver_type, movement_solver_configuration_dict in movement_solver_dict.items(): for solver_type, movement_solver_configuration_list in movement_solver_dict.items():
solver = types_tool[solver_type] solver = types_tool[solver_type]
for other_solver_type in movement_solver_dict.keys(): for other_solver_type in movement_solver_dict.keys():
if other_solver_type == solver_type: if other_solver_type == solver_type:
...@@ -123,12 +124,12 @@ class SolverProcess(XMLObject, ActiveProcess): ...@@ -123,12 +124,12 @@ class SolverProcess(XMLObject, ActiveProcess):
try: try:
# Solver key contains only those properties which differentiate # Solver key contains only those properties which differentiate
# solvers (ex. there should be only Production Reduction Solver) # solvers (ex. there should be only Production Reduction Solver)
solver_key = solver.getSolverProcessGroupingKey(movement_url, movement_solver_configuration_dict, movement_solver_dict, solver_dict[solver_type]) solver_key = solver.getSolverProcessGroupingKey(movement_url, movement_solver_configuration_list, movement_solver_dict)
except: # Raise the exception generated by the solver in case of failure of grouping except: # Raise the exception generated by the solver in case of failure of grouping
raise raise
solver_key_dict = solver_dict.setdefault(solver_type, {}) solver_key_dict = solver_dict.setdefault(solver_type, {})
solver_movement_dict = solver_key_dict.setdefault(solver_key, {}) solver_movement_dict = solver_key_dict.setdefault(solver_key, {})
solver_movement_dict[movement_url] = movement_solver_configuration_dict.keys() solver_movement_dict[movement_url] = movement_solver_configuration_list
# Third, build target solvers # Third, build target solvers
for solver_type, solver_key_dict in solver_dict.items(): for solver_type, solver_key_dict in solver_dict.items():
......
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