Add a safety belt when cube is used with other ones (eg in saem)
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 18 Oct 2016 17:53:43 +0200
changeset 1888 c74d8dd017ce
parent 1887 38c8d9a12bcc
child 1889 0441a4cbec7e
Add a safety belt when cube is used with other ones (eg in saem)
entities/__init__.py
--- a/entities/__init__.py	Tue Oct 18 16:19:14 2016 +0200
+++ b/entities/__init__.py	Tue Oct 18 17:53:43 2016 +0200
@@ -72,6 +72,9 @@
 def _transfer_from_context(rset, entity):
     if entity is None:
         entity = rset.one()
+    # protect against unrelated entity types
+    if not entity.cw_etype.startswith('SEDA'):
+        return None
     if entity.cw_etype != 'SEDAArchiveTransfer':
         entity = parent_and_container(entity)[1]
     return entity