[PATCH 06 of 10 seda] [entities] Add missing selector to SEDAArchiveUnitIClonableAdapter

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Mar 7 15:25:43 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1488351664 -3600
#      Wed Mar 01 08:01:04 2017 +0100
# Node ID 015cf72e71c9c2ed1da5fd775627d8858e6b80ab
# Parent  c202c434a726b3de31c1b2385ae7b092349f0516
[entities] Add missing selector to SEDAArchiveUnitIClonableAdapter

and fix a typo in a comment

diff --git a/cubicweb_seda/entities/__init__.py b/cubicweb_seda/entities/__init__.py
--- a/cubicweb_seda/entities/__init__.py
+++ b/cubicweb_seda/entities/__init__.py
@@ -17,10 +17,12 @@
 
 import json
 
 from logilab.common.registry import objectify_predicate
 
+from cubicweb.predicates import is_instance
+
 from cubes.compound.entities import IContainer, IContained, IClonableAdapter
 
 from .. import seda_profile_container_def
 from ..xsd import XSDMMapping
 from ..xsd2yams import RULE_TYPES
@@ -148,19 +150,20 @@ class DirectLinkIContained(IContained):
         return container and container[0] or None
 
 
 class SEDAArchiveUnitIClonableAdapter(IClonableAdapter):
     """Cloning adapter for SEDA components."""
+    __select__ = is_instance('SEDAArchiveUnit')
     rtype = 'clone_of'
     skiprtypes = ()
 
     def clone_into(self, clone):
         """Recursivily clone the container graph of this entity into `clone`."""
         if clone.seda_archive_unit and (
                 clone.seda_archive_unit[0].cw_etype == 'SEDAArchiveTransfer'
                 or clone.seda_archive_unit[0].container[0].cw_etype == 'SEDAArchiveTransfer'):
-            # clone is parented to a transfer profile, we need to propery handle binary/physical
+            # clone is parented to a transfer profile, we need to properly handle binary/physical
             # data objects
             data_objects = self._cw.execute(
                 'Any X WHERE X is IN (SEDABinaryDataObject, SEDAPhysicalDataObject),'
                 ' X container %(c)s', {'c': self.entity.eid})
         else:


More information about the saem-devel mailing list