[PATCH] Fix overriding SEDAArchiveTransferIClonableAdapter by mistake

Denis Laxalde denis.laxalde at logilab.fr
Fri Jan 26 11:42:10 CET 2018


On Fri, 26 Jan 2018, Philippe Pepiot wrote:

> # HG changeset patch
> # User Philippe Pepiot <philippe.pepiot at logilab.fr>
> # Date 1516961968 -3600
> #      Fri Jan 26 11:19:28 2018 +0100
> # Node ID 980a0729a20707b6a8c1808c9e6fd3a88eae391a
> # Parent  f0e22d15953ec377a921bdeda117ba6365298b9d
> # Available At https://hg.logilab.org/review/cubes/saem_ref
> #              hg pull https://hg.logilab.org/review/cubes/saem_ref -r 980a0729a207
> Fix overriding SEDAArchiveTransferIClonableAdapter by mistake
>
> In seda, SEDAArchiveTransferIClonableAdapter inherit of SEDAArchiveTransferIClonableAdapter.

Should be "SEDAArchiveUnitIClonableAdapter inherits of ...". Will fix
while applying.

THANKS!

> So modifying rtype and skiprtypes for Transfer clone was implicitly modifying Unit clone behavior.
> Unit clone rtype should remain original "clone_of".
>
> Fix by registering a new adapter class for Transfer clone.
>
> Closes extranet #43776568
>
> diff --git a/cubicweb_saem_ref/entities/seda.py b/cubicweb_saem_ref/entities/seda.py
> --- a/cubicweb_saem_ref/entities/seda.py
> +++ b/cubicweb_saem_ref/entities/seda.py
> @@ -55,9 +55,10 @@ def agency_id(self, agency):
>     return None if agency.agency is None else 'ark:/' + agency.agency.ark
> 
> 
> -SEDAArchiveTransferIClonableAdapter.__select__ &= is_in_state('published')
> -SEDAArchiveTransferIClonableAdapter.rtype = 'new_version_of'
> -SEDAArchiveTransferIClonableAdapter.skiprtypes += ('clone_of', 'used', 'generated')
> +class SAEMSEDAArchiveTransferIClonableAdapter(SEDAArchiveTransferIClonableAdapter):
> +    __select__ = SEDAArchiveTransferIClonableAdapter.__select__ & is_in_state('published')
> +    rtype = 'new_version_of'
> +    skiprtypes = SEDAArchiveTransferIClonableAdapter.skiprtypes + ('clone_of', 'used', 'generated')
> 
> 
> class SEDAArchiveTransfer(SEDAArchiveTransfer):
> @@ -174,3 +175,10 @@ class OAISEDA1RNGExportView(OAISEDAExpor
> 
> class OAISEDA2RNGExportView(OAISEDAExportView):
>     __regid__ = 'saem.oai.seda.2.0-rng'
> +
> +
> +def registration_callback(vreg):
> +    vreg.register_and_replace(SAEMSEDAArchiveTransferIClonableAdapter,
> +                              SEDAArchiveTransferIClonableAdapter)
> +    vreg.register_all(globals().values(), __name__,
> +                      butclasses=(SAEMSEDAArchiveTransferIClonableAdapter,))



More information about the saem-devel mailing list