Commit 7dad553f authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[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
parent 25da1e5c7c50
......@@ -562,6 +562,7 @@ class Entity(AppObject):
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):
......
# 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 @@ class EditedEntity(dict):
# 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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment