Commit 413260dc authored by Jérome Perrin's avatar Jérome Perrin

r17682 was wrong, we should not ignore empty string for a key when this key is

also used for sorting.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17696 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 876a1205
......@@ -2217,12 +2217,13 @@ class Catalog(Folder,
# if we have a sort index, we must take it into account to get related
# keys.
sort_key_dict = dict()
if sort_index:
related_key_kw = dict(kw)
for sort_info in sort_index:
sort_key = sort_info[0]
if sort_key not in key_list:
key_list.append(sort_key)
sort_key_dict[sort_key] = 1
related_tuples = self.getSQLCatalogRelatedKeyList(key_list=key_list)
......@@ -2241,8 +2242,10 @@ class Catalog(Folder,
key = t_tuple[0].strip()
if key in key_list:
if ignore_empty_string \
and kw.get(key, '') in ('', [], ()):
# we don't ignore 0
and kw.get(key, None) in ('', [], ())\
and key not in sort_key_dict:
# We don't ignore 0 and None, but if the key is used for sorting,
# we should not discard this key
continue
join_tuple = t_tuple[1].strip().split('/')
related_keys[key] = None
......
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