ITreeBase.parent on data object of simplified profile should return related archive unit
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 25 Aug 2016 17:52:05 +0200
changeset 1558 a12c97e1c4d4
parent 1557 789ccdadf81d
child 1559 ac4598bdf2c5
ITreeBase.parent on data object of simplified profile should return related archive unit not the transfer entity.
entities/itree.py
--- a/entities/itree.py	Thu Aug 25 17:30:51 2016 +0200
+++ b/entities/itree.py	Thu Aug 25 17:52:05 2016 +0200
@@ -123,6 +123,14 @@
     __select__ = is_instance('SEDABinaryDataObject', 'SEDAPhysicalDataObject')
 
 
+class ITreeBaseSimplifiedDataObjectAdapter(ITreeBaseDataObjectAdapter):
+
+    __select__ = ITreeBaseDataObjectAdapter.__select__ & simplified_profile()
+
+    def parent(self):
+        return parent_archive_unit(self.entity.reverse_seda_data_object_reference_id[0])
+
+
 class ITreeBaseArchiveTransferAdapter(IContainedToITreeBase):
     """Adapt ArchiveTransfer entities to ITreeBase."""