[PATCH 1 of 2 seda] Make ProfileTreeComponent abstract

Denis Laxalde denis.laxalde at logilab.fr
Fri Sep 28 10:16:34 CEST 2018


Frank Bessou a écrit :
> 
> 
> On 27/09/2018 16:40, Denis Laxalde wrote:
>> Frank Bessou a écrit :
>>> # 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'))
>>
>> I guess "is_instance('SEDAArchiveTransfer')" should not be added?
> 
> You guessed right. Fixed in 0b663b4c509f . Thanks :)

Applied that one, thanks.

> 
> 
>>
>>> +    __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