Commit c063c8d0 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Solver: Solving two divergences with two Solvers on different properties...

Solver: Solving two divergences with two Solvers on different properties should not be considered a conflict.

Use case:
  * Property 1: Accept Solver on 'title'.
  * Property 2: Adopt Solver on 'start_date'.
=> This was not implemented and raising an error as AppropriateUIMessage(whatever) is not defined.

movement_dict:
  {<Simulation Movement at /erp5/portal_simulation/133959/1/1/1>: {<Solver Type at /erp5/portal_solvers/Adopt Solver>: [(('tested_property_list',
                                                                                                                          ['title']),)],
                                                                   <Solver Type at /erp5/portal_solvers/Accept Solver>: [(('tested_property_list',
                                                                                                                           ['stop_date']),),
                                                                                                                         (('tested_property_list',
                                                                                                                           ['start_date']),)]}}
self: <Solver Type at /erp5/portal_solvers/Adopt Solver>
  self.getTestedProperty() is None
solver: <Solver Type at /erp5/portal_solvers/Accept Solver>
  solver.getTestedProperty() is None
parent acd3b231
...@@ -81,12 +81,16 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation): ...@@ -81,12 +81,16 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
# Default Implementation (use categories and trivial case) # Default Implementation (use categories and trivial case)
# this default implementation should be applicable to most # this default implementation should be applicable to most
# solvers so that use of Type Based methods is very rare # solvers so that use of Type Based methods is very rare
message_list = []
for solver, configuration_list in movement_dict[movement].items(): for solver, configuration_list in movement_dict[movement].items():
if solver is not self and solver.getTestedProperty() == self.getTestedProperty(): if solver is not self and configuration_mapping in configuration_list:
return AppropriateUIMessage(whatever) # XXX-TODO # TODO: Use Message() class and avoid duplicate (this method will be
# called for the other solver and add the same message again...)
# Return emtpty message list message_list.append(
return () "%s: Solver conflict on %r between '%s' and '%s'" % \
(movement.getRelativeUrl(), configuration_mapping, self, solver))
return message_list
def getSolverProcessGroupingKey(self, movement, configuration_mapping, solver_dict, movement_dict): def getSolverProcessGroupingKey(self, movement, configuration_mapping, solver_dict, movement_dict):
""" """
......
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