# HG changeset patch # User Sylvain Thénault # Date 1343121556 -7200 # Node ID 1527b012802f2308d9dc46e2485f10b548d1a8c5 # Parent 25da1e5c7c50c09811068ce6daa811847e3c48d0 [entity] more tweaks for entity attribute cache handling on cw_set/cw_create to fix test regression * when an attribute is listed in dont-cache-attrs, purge any previous value * test value is actually modified in EditedEntity.__setitem__ before adding attribute to dont-cache-attrs diff -r 25da1e5c7c50 -r 1527b012802f entity.py --- a/entity.py Tue Jul 24 10:16:25 2012 +0200 +++ b/entity.py Tue Jul 24 11:19:16 2012 +0200 @@ -562,6 +562,7 @@ for key in self._cw.get_shared_data('%s.dont-cache-attrs' % self.eid, default=(), txdata=True, pop=True): attrcache.pop(key, None) + self.cw_attr_cache.pop(key, None) self.cw_attr_cache.update(attrcache) def _cw_dont_cache_attribute(self, attr): diff -r 25da1e5c7c50 -r 1527b012802f server/edition.py --- a/server/edition.py Tue Jul 24 10:16:25 2012 +0200 +++ b/server/edition.py Tue Jul 24 11:19:16 2012 +0200 @@ -1,4 +1,4 @@ -# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of CubicWeb. @@ -61,7 +61,10 @@ # attributes, else we may accidentaly skip a desired security check if attr not in self: self.skip_security.add(attr) - self.entity._cw_dont_cache_attribute(attr) + elif value != self[attr]: + # also, if value differs, mark attribute as needing purge by the + # client + self.entity._cw_dont_cache_attribute(attr) self.edited_attribute(attr, value) def __delitem__(self, attr):