Commit 3153f349 authored by Frank Bessou's avatar Frank Bessou 🍁
Browse files

Make the component_unit predicate work with non seda entities

In the component_unit predicate, we handle the case where
_seda_container_from_context returns None by returning 0.
This can be the case when the predicate is called with a non seda
entity.
parent 01c4f249e161
......@@ -97,7 +97,9 @@ def component_unit(cls, req, rset=None, entity=None, **kwargs):
container root is not a SEDAArchiveTransfer but a SEDAArchiveUnit).
"""
entity = _seda_container_from_context(rset, entity, **kwargs)
return 1 if entity.cw_etype == 'SEDAArchiveUnit' else 0
if entity and entity.cw_etype == 'SEDAArchiveUnit':
return 1
return 0
@objectify_predicate
......
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