Commit a54722da authored by Yoshinori Okuji's avatar Yoshinori Okuji

Unify invented mode with normal mode.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4107 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 974a81d4
...@@ -177,38 +177,39 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -177,38 +177,39 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
#LOG("Selection", 0, str(method)) #LOG("Selection", 0, str(method))
#LOG('Selection', 0, "self.invert_mode = %s" % repr(self.invert_mode)) #LOG('Selection', 0, "self.invert_mode = %s" % repr(self.invert_mode))
if self.invert_mode is 0: if self.invert_mode is 0:
if method is None or type(method) is type('a'): kw = self.params
method_path = method or self.method_path else:
method = context.unrestrictedTraverse(method_path) kw = self.params.copy()
if type(method) is type('a'): kw['uid'] = self.uids
method = context.unrestrictedTraverse(self.method_path) if method is None or type(method) is type('a'):
sort_on = getattr(self, 'sort_on', []) method_path = method or self.method_path
if len(sort_on) == 0: method = context.unrestrictedTraverse(method_path)
sort_on = getattr(self, 'default_sort_on', []) if type(method) is type('a'):
if len(sort_on) > 0: method = context.unrestrictedTraverse(self.method_path)
self.params['sort_on'] = sort_on sort_on = getattr(self, 'sort_on', [])
elif self.params.has_key('sort_on'): if len(sort_on) == 0:
del self.params['sort_on'] sort_on = getattr(self, 'default_sort_on', [])
if method is not None: if len(sort_on) > 0:
if callable(method): self.params['sort_on'] = sort_on
#LOG('Selection', 0, "self.params = %s" % repr(self.params)) elif self.params.has_key('sort_on'):
if self.domain is not None and self.report is not None: del self.params['sort_on']
result = method(selection_domain = self.domain, if method is not None:
selection_report = self.report, selection=self, **self.params) if callable(method):
elif self.domain is not None: #LOG('Selection', 0, "self.params = %s" % repr(self.params))
result = method(selection_domain = self.domain, selection=self, **self.params) if self.domain is not None and self.report is not None:
elif self.report is not None: result = method(selection_domain = self.domain,
result = method(selection_report = self.report, selection=self, **self.params) selection_report = self.report, selection=self, **kw)
else: elif self.domain is not None:
result = method(selection=self, **self.params) result = method(selection_domain = self.domain, selection=self, **kw)
return result elif self.report is not None:
result = method(selection_report = self.report, selection=self, **kw)
else: else:
return [] result = method(selection=self, **kw)
return result
else: else:
return [] return []
else: else:
# We sould try to allow more filtering return []
return context.portal_catalog(uid = self.uids, **self.params)
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