Commit 647405f1 authored by Vincent Pelletier's avatar Vincent Pelletier

CatalogTool: Simplify getCategoryValueDictParameterDict a bit.

Also, document that value order in base_category_dict is meaningless.
parent 5e4668ea
...@@ -1043,7 +1043,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -1043,7 +1043,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
reverse relation) membership to these documents with their respective reverse relation) membership to these documents with their respective
base categories. base categories.
base_category_dict (dict with base category ids as keys and document lists base_category_dict (dict with base category ids as keys and document sets
as values) as values)
Note: mutated by this method. Note: mutated by this method.
category_table ('category' or 'predicate_category') category_table ('category' or 'predicate_category')
...@@ -1068,13 +1068,11 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -1068,13 +1068,11 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
prefix = ('_'.join(flag_list) + '__') if flag_list else '' prefix = ('_'.join(flag_list) + '__') if flag_list else ''
suffix = ('' if forward else '__related') + '__uid' suffix = ('' if forward else '__related') + '__uid'
parent_uid_set = base_category_dict.pop('parent', None) parent_uid_set = base_category_dict.pop('parent', None)
base_category_uid_dict = {
base_category_id: {document.getUid() for document in document_set}
for base_category_id, document_set in base_category_dict.iteritems()
}
result = { result = {
prefix + x + suffix: y prefix + base_category_id + suffix: {
for x, y in base_category_uid_dict.iteritems() document.getUid() for document in document_set
}
for base_category_id, document_set in base_category_dict.iteritems()
} }
if parent_uid_set is not None: if parent_uid_set is not None:
result['parent_uid'] = parent_uid_set result['parent_uid'] = parent_uid_set
......
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