[PATCH 1 of 2 seda] Make ProfileTreeComponent abstract

Frank Bessou frank.bessou at logilab.fr
Thu Sep 27 16:05:02 CEST 2018


# HG changeset patch
# User Frank Bessou <frank.bessou at logilab.fr>
# Date 1538055218 -7200
#      Thu Sep 27 15:33:38 2018 +0200
# Node ID cc7900e2bfed295f42d2bea92f2f29882d5412ec
# Parent  01c4f249e16137b9cc371a5677d3aea35f32cd5a
# Available At http://hg.logilab.org/review/cubes/seda
#              hg pull http://hg.logilab.org/review/cubes/seda -r cc7900e2bfed
Make ProfileTreeComponent abstract

We make ProfileTreeComponent abstract to avoid selecting it for any
entity that can be adapted to ITreeBase. Indeed, we don't want Concepts
to be rendered as contextual components in cube saem.

We then create a TransferTreeComponent extending ProfileTreeComponent
the same way we made the UnitTreeComponent.

diff --git a/cubicweb_seda/views/sedatree.py b/cubicweb_seda/views/sedatree.py
--- a/cubicweb_seda/views/sedatree.py
+++ b/cubicweb_seda/views/sedatree.py
@@ -28,10 +28,11 @@ class ProfileTreeComponent(component.Ent
     """Display the whole profile tree."""
     __regid__ = 'seda.tree'
     __select__ = (component.EntityCtxComponent.__select__
-                  & adaptable('ITreeBase'))
+                  & adaptable('ITreeBase')
+                  & is_instance('SEDAArchiveTransfer'))
+    __abstract__ = True
     context = 'left'
     order = -1
-    title = _('SEDA profile tree')
 
     def render_body(self, w):
         self._cw.add_css('cubes.jqtree.css')
@@ -39,6 +40,11 @@ class ProfileTreeComponent(component.Ent
         self.entity.view('jqtree.treeview', w=w)
 
 
+class TransferTreeComponent(ProfileTreeComponent):
+    __select__ = ProfileTreeComponent.__select__ & is_instance('SEDAArchiveTransfer')
+    title = _('SEDA profile tree')
+
+
 class UnitTreeComponent(ProfileTreeComponent):
     __select__ = ProfileTreeComponent.__select__ & component_unit()
     title = _('Archive unit component tree')



More information about the saem-devel mailing list