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

Denis Laxalde denis.laxalde at logilab.fr
Mon Mar 13 08:57:14 CET 2017


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.



More information about the saem-devel mailing list