# HG changeset patch # User Sylvain Thénault # Date 1249920050 -7200 # Node ID 2c94606eefc05a0f033e64a0a70641a0fdc69652 # Parent e69a4077ffb4cf391c2458f742bba92dff293760 [server caching] should set cache before call to after_add_entity hooks diff -r e69a4077ffb4 -r 2c94606eefc0 server/repository.py --- a/server/repository.py Mon Aug 10 16:02:14 2009 +0200 +++ b/server/repository.py Mon Aug 10 18:00:50 2009 +0200 @@ -1030,6 +1030,9 @@ if rtype in VIRTUAL_RTYPES: continue entity.set_related_cache(rtype, 'object', session.empty_rset()) + # set inline relation cache before call to after_add_entity + for attr, value in relations: + session.update_rel_cache_add(entity.eid, attr, value) # trigger after_add_entity after after_add_relation if source.should_call_hooks: self.hm.call_hooks('after_add_entity', etype, session, entity) @@ -1037,7 +1040,6 @@ for attr, value in relations: self.hm.call_hooks('before_add_relation', attr, session, entity.eid, attr, value) - session.update_rel_cache_add(entity.eid, attr, value) self.hm.call_hooks('after_add_relation', attr, session, entity.eid, attr, value) return entity.eid