[PATCH 1 of 2 seda] Refactor conditional logic in SimplifiedProfileDelRefROHook a bit

Denis Laxalde denis.laxalde at logilab.fr
Thu Dec 20 09:34:39 CET 2018


Up, please :)

Denis Laxalde a écrit :
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1544776759 -3600
> #      Fri Dec 14 09:39:19 2018 +0100
> # Node ID 049322b9d8eeb3e954a91ebeeef5a5aaf5ca8a58
> # Parent  181f83e6b54551d99fe7717e5544f86689e4db0c
> # Available At http://hg.logilab.org/review/cubes/seda
> #              hg pull http://hg.logilab.org/review/cubes/seda -r 049322b9d8ee
> # EXP-Topic CONSEJIRA-643
> Refactor conditional logic in SimplifiedProfileDelRefROHook a bit
> 
> This is a preparatory refactoring to ease introduction of a functional
> change in the next changeset.
> 
> diff --git a/cubicweb_seda/hooks.py b/cubicweb_seda/hooks.py
> --- a/cubicweb_seda/hooks.py
> +++ b/cubicweb_seda/hooks.py
> @@ -310,9 +310,11 @@ class SimplifiedProfileDelRefROHook(hook
>          ref = self._cw.entity_from_eid(self.eidfrom)
>          bdo = self._cw.entity_from_eid(self.eidto)
>          if ref.cw_etype == 'SEDADataObjectReference' and bdo.cw_etype == 'SEDABinaryDataObject':
> -            container = bdo.seda_binary_data_object[0] if bdo.seda_binary_data_object else None
> -            if container and container.simplified_profile:
> -                SimplifiedProfileDelRefROOp(self._cw, do_ref=ref, do=bdo)
> +            if bdo.seda_binary_data_object:
> +                container = bdo.seda_binary_data_object[0]
> +                if not container.simplified_profile:
> +                    return
> +            SimplifiedProfileDelRefROOp(self._cw, do_ref=ref, do=bdo)
>  
>  
>  class SimplifiedProfileDelRefROOp(hook.Operation):
> 



More information about the saem-devel mailing list