Commit 8edd8f38 authored by Aurel's avatar Aurel

spec must be a tuple otherwise retrieval from cache fail as a list is not hashable

parent 0191a23e
...@@ -585,8 +585,10 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -585,8 +585,10 @@ class CategoryTool( UniqueObject, Folder, Base ):
category_list = [base_category] category_list = [base_category]
else: else:
category_list = base_category category_list = base_category
if not isinstance(spec, (tuple, list)): if isinstance(spec, str):
spec = [spec] spec = (spec,)
elif isinstance(spec, list):
spec = tuple(spec)
spec_len = len(spec) spec_len = len(spec)
for path in self._getCategoryList(context): for path in self._getCategoryList(context):
# LOG('getCategoryMembershipList',0,str(path)) # LOG('getCategoryMembershipList',0,str(path))
...@@ -815,7 +817,9 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -815,7 +817,9 @@ class CategoryTool( UniqueObject, Folder, Base ):
append = result.append append = result.append
# Make sure spec is a list or tuple # Make sure spec is a list or tuple
if isinstance(spec, str): if isinstance(spec, str):
spec = [spec] spec = (spec,)
elif isinstance(spec, list):
spec = tuple(spec)
spec_len = len(spec) spec_len = len(spec)
# Filter categories # Filter categories
if getattr(aq_base(context), 'categories', _marker) is not _marker: if getattr(aq_base(context), 'categories', _marker) is not _marker:
...@@ -930,7 +934,9 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -930,7 +934,9 @@ class CategoryTool( UniqueObject, Folder, Base ):
if spec is (): if spec is ():
spec = portal_type # This is bad XXX - JPS - spec is for meta_type, not for portal_type - be consistent ! spec = portal_type # This is bad XXX - JPS - spec is for meta_type, not for portal_type - be consistent !
if isinstance(spec, str): if isinstance(spec, str):
spec = [spec] spec = (spec,)
elif isinstance(spec, list):
spec = tuple(spec)
if isinstance(acquired_portal_type, str): if isinstance(acquired_portal_type, str):
acquired_portal_type = [acquired_portal_type] acquired_portal_type = [acquired_portal_type]
......
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