Commit 5b6579aa authored by Julien Muchembled's avatar Julien Muchembled

searchAndActivate: sorting results was useless when activity_count=None

parent 9321cec0
...@@ -1376,13 +1376,17 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -1376,13 +1376,17 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
group_method_cost = group_kw.get('group_method_cost', .034) # 30 objects group_method_cost = group_kw.get('group_method_cost', .034) # 30 objects
if limit == 0: if limit == 0:
limit = 100 * int(ceil(1 / group_method_cost)) limit = 100 * int(ceil(1 / group_method_cost))
if min_uid:
catalog_kw['min_uid'] = SimpleQuery(uid=min_uid,
comparison_operator='>')
if catalog_kw.pop('restricted', False): if catalog_kw.pop('restricted', False):
search = self search = self
else: else:
search = self.unrestrictedSearchResults search = self.unrestrictedSearchResults
if limit is None:
r = search(**catalog_kw)
else:
if min_uid:
catalog_kw['min_uid'] = SimpleQuery(uid=min_uid,
comparison_operator='>')
r = search(sort_on=(('uid','ascending'),), limit=limit, **catalog_kw) r = search(sort_on=(('uid','ascending'),), limit=limit, **catalog_kw)
result_count = len(r) result_count = len(r)
if result_count: if result_count:
......
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