# HG changeset patch # User Julien Cristau # Date 1437495451 -7200 # Node ID 2b398e58ea7351ceb94389ceacb7a0d091f2da6d # Parent a05a698a12af2896245345683aef86ee0aa8e7de [hook] remove assumption about entity cache vs cw_edited We were assuming that if an entity is in the connection's cache, it has a cw_edited attribute. This doesn't seem to always be the case. At least in cubicweb 3.21, merging the web and repo-side caches makes this more likely, but Denis says he's also seen this on 3.20. diff -r a05a698a12af -r 2b398e58ea73 hooks/security.py --- a/hooks/security.py Tue Jul 21 18:09:12 2015 +0200 +++ b/hooks/security.py Tue Jul 21 18:17:31 2015 +0200 @@ -146,7 +146,10 @@ entity = cnx.entity_cache(eid) except KeyError: return False - return rschema.type in entity.cw_edited.skip_security + edited = getattr(entity, 'cw_edited', None) + if edited is None: + return False + return rschema.type in edited.skip_security class BeforeAddRelationSecurityHook(SecurityHook):