Do not handle physical data object in archive unit of simplified profiles
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Aug 2016 08:29:44 +0200
changeset 1575 2d1ed86e4725
parent 1574 b26ac24f94f4
child 1576 370df5f16508
Do not handle physical data object in archive unit of simplified profiles
views/archiveunit.py
--- a/views/archiveunit.py	Fri Aug 26 08:13:31 2016 +0200
+++ b/views/archiveunit.py	Fri Aug 26 08:29:44 2016 +0200
@@ -28,7 +28,7 @@
 from cubes.seda.entities.itree import parent_archive_unit
 from cubes.seda.views import (add_subobject_link, add_subobjects_button, dropdown_button,
                               rtags_from_rtype_role_targets, copy_rtag)
-from cubes.seda.views import viewlib, widgets, archivetransfer, content
+from cubes.seda.views import viewlib, widgets, content
 from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
 
@@ -377,9 +377,10 @@
 
     __select__ = ArchiveUnitDataObjectReferencesTab.__select__ & simplified_profile()
 
+    rtype_role_targets = [('seda_binary_data_object', 'object', 'SEDABinaryDataObject')]
+
     def display_add_button(self, entity):
-        rtype_role_targets = archivetransfer.ArchiveTransferDataObjectsTab.rtype_role_targets
-        rtype_roles = [(rtype, role) for rtype, role, _ in rtype_role_targets]
+        rtype_roles = [(rtype, role) for rtype, role, _ in self.rtype_role_targets]
         params = self.url_params(entity)
         params['referenced_by'] = unicode(entity.eid)
         transfer = entity.container[0]
@@ -390,16 +391,14 @@
             self.w(tags.div(klass='clearfix'))
 
     def display_subobjects_list(self, entity):
-        for target in ('SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
-            rset = self._cw.execute(
-                'Any DO, DOID, DOUC ORDERBY DOID WHERE DO is {0}, '
-                'DO id DOID, DO user_cardinality DOUC, '
-                'REF seda_data_object_reference_id DO, REF seda_data_object_reference SEQ, '
-                'SEQ eid %(x)s'.format(target), {'x': entity.eid})
-            if rset:
-                self.w('<h2>%s</h2>' % self._cw.__(target + '_plural'))
-                self._cw.view('list', rset=rset, parent=self.parent(entity), w=self.w,
-                              subvid=self.subvid, tabid=self.__regid__)
+        rset = self._cw.execute(
+            'Any DO, DOID, DOUC ORDERBY DOID WHERE '
+            'DO id DOID, DO user_cardinality DOUC, '
+            'REF seda_data_object_reference_id DO, REF seda_data_object_reference SEQ, '
+            'SEQ eid %(x)s', {'x': entity.eid})
+        if rset:
+            self._cw.view('list', rset=rset, parent=self.parent(entity), w=self.w,
+                          subvid=self.subvid, tabid=self.tabid)
 
 
 # Top level ArchiveUnit form: create to distinct forms, one form archive unit reference and the