Move entity_call method in parent abc for tabs displaying objects below archive unit's content sequence
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Aug 2016 08:13:31 +0200
changeset 1574 b26ac24f94f4
parent 1573 bc6f8557fc81
child 1575 2d1ed86e4725
Move entity_call method in parent abc for tabs displaying objects below archive unit's content sequence
views/archiveunit.py
--- a/views/archiveunit.py	Thu Aug 25 17:52:44 2016 +0200
+++ b/views/archiveunit.py	Fri Aug 26 08:13:31 2016 +0200
@@ -213,11 +213,18 @@
 
 
 class ArchiveUnitSubObjectsTab(viewlib.SubObjectsTab):
-    """Abstract subobjects tab specific to archive unit to handle proper redirection"""
+    """Abstract subobjects tab specific to archive unit to handle subentities below choice>sequence
+    child transparently.
+    """
 
     __abstract__ = True
     __select__ = EntityView.__select__ & is_instance('SEDAArchiveUnit') & ~is_archive_unit_ref()
 
+    def entity_call(self, entity):
+        seq = entity.first_level_choice.content_sequence
+        self.display_add_button(seq)
+        self.display_subobjects_list(seq)
+
     def url_params(self, entity):
         archive_unit = parent_archive_unit(entity)
         return {'__redirectparams': 'tab=' + self.__regid__,
@@ -237,11 +244,6 @@
     _('creating SEDAContent (SEDAContent seda_content '
       'SEDASeqAltArchiveUnitArchiveUnitRefIdManagement %(linkto)s)')
 
-    def entity_call(self, entity):
-        seq = entity.first_level_choice.content_sequence
-        self.display_add_button(seq)
-        self.display_subobjects_list(seq)
-
     def display_subobjects_list(self, entity):
         rset = entity.related('seda_content', 'object')
         self._cw.view('list', rset=rset, parent=self.parent(entity), w=self.w,
@@ -366,11 +368,6 @@
     _('creating SEDADataObjectReference (SEDADataObjectReference seda_data_object_reference '
       'SEDASeqAltArchiveUnitArchiveUnitRefIdManagement %(linkto)s)')
 
-    def entity_call(self, entity):
-        seq = entity.first_level_choice.content_sequence
-        self.display_add_button(seq)
-        self.display_subobjects_list(seq)
-
 
 class SimplifiedArchiveUnitDataObjectReferencesTab(ArchiveUnitDataObjectReferencesTab):
     """Tab for data object references of an archive unit within a simplified transfer: see