[PATCH 2 of 4 seda] [entities] Rename variable to container to avoid name conflict

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Apr 21 17:53:26 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1492783489 -7200
#      Fri Apr 21 16:04:49 2017 +0200
# Node ID 9705a695191b6b698e512aa4532903aed954a5fb
# Parent  5bfec4248b695754784caf9149c5a6e466022b4a
[entities] Rename variable to container to avoid name conflict

since it's not the same thing as the entity received in arguments.

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
@@ -98,17 +98,17 @@ def component_unit(cls, req, rset=None, 
 
 
 @objectify_predicate
 def simplified_profile(cls, req, rset=None, entity=None, **kwargs):
     """Predicate returning 1 score if context entity is within a simplified profile."""
-    entity = _seda_container_from_context(rset, entity, **kwargs)
-    if entity is None:
+    container = _seda_container_from_context(rset, entity, **kwargs)
+    if container is None:
         return 0
-    if entity.cw_etype == 'SEDAArchiveUnit':
+    if container.cw_etype == 'SEDAArchiveUnit':
         # XXX archive unit component, for now suppose it's "simplified"
         return 1
-    return 1 if entity.simplified_profile else 0
+    return 1 if container.simplified_profile else 0
 
 
 def is_full_seda2_profile(entity=None, rset=None, **kwargs):
     """Return 1 if context entity is within a full seda2 profile, else 0."""
     entity = _seda_container_from_context(rset, entity, **kwargs)


More information about the saem-devel mailing list