Commit bfb0ba58 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

some divergence testers can be only for matching, not for divergence testing....

some divergence testers can be only for matching, not for divergence testing. so we need a way to recognise if a tester is for divergence testing or not.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31126 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9dbaa83d
...@@ -39,6 +39,11 @@ class DivergenceTester: ...@@ -39,6 +39,11 @@ class DivergenceTester:
'type' : 'lines', 'type' : 'lines',
'default' : (), 'default' : (),
'mode' : 'w' }, 'mode' : 'w' },
{ 'id' : 'testing_provider',
'description' : 'Defines whether a divergence tester acts as a testing provider.',
'type' : 'boolean',
'default' : 0,
'mode' : 'rw' },
{ 'id' : 'matching_provider', { 'id' : 'matching_provider',
'description' : 'Defines whether a divergence tester acts as a matching provider.', 'description' : 'Defines whether a divergence tester acts as a matching provider.',
'type' : 'boolean', 'type' : 'boolean',
......
...@@ -235,20 +235,14 @@ class RuleMixin: ...@@ -235,20 +235,14 @@ class RuleMixin:
""" """
raise NotImplementedError raise NotImplementedError
def _getDivergenceTesterList(self, exclude_quantity=True): def _getDivergenceTesterList(self):
""" """
Return the applicable divergence testers which must Return the applicable divergence testers which must
be used to test movement divergence. be used to test movement divergence. (ie. not all
divergence testers of the Rule)
exclude_quantity -- if set to true, do not consider
quantity divergence testers
""" """
tester_list = self.objectValues( return filter(lambda x:x.isTestingProvider(), self.objectValues(
portal_type=self.getPortalDivergenceTesterTypeList()) portal_type=self.getPortalDivergenceTesterTypeList()))
if exclude_quantity:
return [x for x in tester_list if x.getTestedProperty() != 'quantity']
else:
return tester_list
def _getMatchingTesterList(self): def _getMatchingTesterList(self):
""" """
...@@ -256,7 +250,8 @@ class RuleMixin: ...@@ -256,7 +250,8 @@ class RuleMixin:
be used to match movements and build the diff (ie. be used to match movements and build the diff (ie.
not all divergence testers of the Rule) not all divergence testers of the Rule)
""" """
raise NotImplementedError return filter(lambda x:x.isMatchingProvider(), self.objectValues(
portal_type=self.getPortalDivergenceTesterTypeList()))
def _getQuantityTesterList(self): def _getQuantityTesterList(self):
""" """
......
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