[PATCH 1 of 1 saem_ref V2] [views] Customize title of SEDAArchiveTransferCloneAction

Sylvain Thénault sylvain.thenault at logilab.fr
Tue Mar 14 10:41:47 CET 2017



Le 13/03/2017 à 08:57, Denis Laxalde a écrit :
> Sylvain Thenault a écrit :
>> # HG changeset patch
>> # User Sylvain Thénault <sylvain.thenault at logilab.fr>
>> # Date 1489136022 -3600
>> #      Fri Mar 10 09:53:42 2017 +0100
>> # Node ID a7faf18c1c847045368fdb882f70fab215f308e6
>> # Parent  cb200331407a36c18b3ba823b4bcc14190ca3682
>> [views] Customize title of SEDAArchiveTransferCloneAction
>>
>> accidentaly dropped by 57c663b9798a
>>
>> diff --git a/cubicweb_saem_ref/views/clone.py
>> b/cubicweb_saem_ref/views/clone.py
>> --- a/cubicweb_saem_ref/views/clone.py
>> +++ b/cubicweb_saem_ref/views/clone.py
>> @@ -35,12 +35,15 @@ simplified_pvs.tag_object_of(('*', 'new_
>>
>>  # life-cycle management
>> ############################################################################
>>
>>  # Only show clone action for SEDA profiles if no clone has been
>> created yet
>>
>> -SEDAArchiveTransferCloneAction.__select__ &=
>> (~has_related_entities('new_version_of', 'object')
>> -                                              &
>> is_in_state('published'))
>> +class
>> SAEMSEDAArchiveTransferCloneAction(SEDAArchiveTransferCloneAction):
>> +    __select__ = (SEDAArchiveTransferCloneAction.__select__
>> +                  & ~has_related_entities('new_version_of', 'object')
>> +                  & is_in_state('published'))
>> +    title = _('new version')
>>
>>
>>  def workflow_state(entity):
>>      """Return the state of the given entity."""
>>      return entity.cw_adapt_to('IWorkflowable').state
>> @@ -91,5 +94,10 @@ class SEDAArchiveTransferRelatedVersions
>>                  w(u'<li class="list-group-item">')
>>                  w(tags.span(self._cw._(workflow_state(entity)),
>> klass='badge'))
>>                  entity.view('incontext', w=w)
>>                  w(u'</li>')
>>              w(u'</ul>')
>> +
>> +
>> +def registration_callback(vreg):
>> +    vreg.register_all(globals().values(), __name__)
>> +    vreg.unregister(SEDAArchiveTransferCloneAction)
>>
>
> I'd find it clearer with a register_and_replace + ignore in register_all.

this was a new style attempt, I understand you don't like it ;)

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org



More information about the saem-devel mailing list