ITreeBase.iterchildren on archive unit of simplified profile shouldn't return content subentities
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 25 Aug 2016 18:03:23 +0200
changeset 1572 7c37ce56f26d
parent 1571 21a6626578ee
child 1573 bc6f8557fc81
ITreeBase.iterchildren on archive unit of simplified profile shouldn't return content subentities
entities/itree.py
--- a/entities/itree.py	Thu Aug 25 16:20:33 2016 +0200
+++ b/entities/itree.py	Thu Aug 25 18:03:23 2016 +0200
@@ -75,6 +75,8 @@
 
     __select__ = is_instance('SEDAArchiveUnit')
 
+    _children_relations = [('seda_content', 'object'), ('seda_archive_unit', 'object')]
+
     def parent(self):
         parent = self.entity.cw_adapt_to('IContained').parent
         if parent.cw_etype == 'SEDAArchiveTransfer':
@@ -86,7 +88,7 @@
         if seq is None:
             # 'reference' archive unit
             return
-        for rel, role in [('seda_content', 'object'), ('seda_archive_unit', 'object')]:
+        for rel, role in self._children_relations:
             for child in seq.related(rel, role, entities=True):
                 yield child
 
@@ -95,6 +97,8 @@
 
     __select__ = ITreeBaseArchiveUnitAdapter.__select__ & simplified_profile()
 
+    _children_relations = [('seda_archive_unit', 'object')]
+
     def iterchildren(self):
         for child in super(ITreeBaseSimplifiedArchiveUnitAdapter, self).iterchildren():
             yield child