Commit 81301d2f authored by Alexandre Boeglin's avatar Alexandre Boeglin

Modified setCriterion so that _identity_criterion and _range_criterion are not...

Modified setCriterion so that _identity_criterion and _range_criterion are not set if the form fields weren't set (instead of adding [] or '' to these properties).
Added an edit function that checks criterion_property_list and cleans _identity_criterion and _range_criterion from unused values.

This allows the test method to work correctly.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1905 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 678dc9c1
...@@ -194,13 +194,31 @@ identify a bank account.""" ...@@ -194,13 +194,31 @@ identify a bank account."""
criterion_list.sort() criterion_list.sort()
return criterion_list return criterion_list
security.declareProtected( Permissions.ModifyPortalContent, 'setCriterionList' ) security.declareProtected( Permissions.ModifyPortalContent, 'setCriterion' )
def setCriterion(self, property, identity=None, min=None, max=None, **kw): def setCriterion(self, property, identity=None, min=None, max=None, **kw):
if not hasattr(aq_base(self), '_identity_criterion'): if not hasattr(aq_base(self), '_identity_criterion'):
self._identity_criterion = {} self._identity_criterion = {}
self._range_criterion = {} self._range_criterion = {}
self._identity_criterion[property] = identity if identity != [] :
self._range_criterion[property] = (min, max) self._identity_criterion[property] = identity
if min != '' or max != '' :
self._range_criterion[property] = (min, max)
security.declareProtected( Permissions.ModifyPortalContent, 'edit' )
def edit(self, **kwd) :
if 'criterion_property_list' in kwd.keys() :
criterion_property_list = kwd['criterion_property_list']
identity_criterion = {}
range_criterion = {}
for criterion in self._identity_criterion.keys() :
if criterion in criterion_property_list :
identity_criterion[criterion] = self._identity_criterion[criterion]
for criterion in self._range_criterion.keys() :
if criterion in criterion_property_list :
range_criterion[criterion] = self._range_criterion[criterion]
self._identity_criterion = identity_criterion
self._range_criterion = range_criterion
return self._edit(**kwd)
# Predicate fusion method # Predicate fusion method
def setPredicateCategoryList(self, category_list): def setPredicateCategoryList(self, category_list):
......
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