Commit fed08b3e authored by Vincent Pelletier's avatar Vincent Pelletier

Simplify Selection.__call__ code.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26542 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2875a6e2
...@@ -205,22 +205,16 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -205,22 +205,16 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
del kw['sort_on'] # We should not sort if no sort was defined del kw['sort_on'] # We should not sort if no sort was defined
# We should always set selection_name with self.name # We should always set selection_name with self.name
kw['selection_name'] = self.name kw['selection_name'] = self.name
if method is not None: kw['selection'] = self
if self.domain is not None:
kw['selection_domain'] = self.domain
if self.report is not None:
kw['selection_report'] = self.report
if callable(method): if callable(method):
if self.domain is not None and self.report is not None: result = method(**kw)
result = method(selection_domain = self.domain,
selection_report = self.report, selection=self, **kw)
elif self.domain is not None:
result = method(selection_domain = self.domain, selection=self, **kw)
elif self.report is not None:
result = method(selection_report = self.report, selection=self, **kw)
else: else:
result = method(selection=self, **kw) result = []
return result return result
else:
return []
else:
return []
def __getitem__(self, index, REQUEST=None): def __getitem__(self, index, REQUEST=None):
return self(REQUEST)[index] return self(REQUEST)[index]
......
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