# HG changeset patch # User Sylvain Thénault # Date 1343993377 -7200 # Node ID c09feae040946b5b0f574ef20ca953f03c221645 # Parent 552de9f0c46debd8e5c1af97203a6f64d6d4af9b [entity edition] don't remove values from attribute cache on the repository side This follows changesets 552de9f0c46d, 1527b012802f, 25da1e5c7c50 and 4ba11607d84a. closes #2423719 ? diff -r 552de9f0c46d -r c09feae04094 entity.py --- a/entity.py Thu Aug 02 19:00:22 2012 +0200 +++ b/entity.py Fri Aug 03 13:29:37 2012 +0200 @@ -559,10 +559,14 @@ raise NotImplementedError('comparison not implemented for %s' % self.__class__) def _cw_update_attr_cache(self, attrcache): - 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) + # if context is a repository session, don't consider dont-cache-attrs as + # the instance already hold modified values and loosing them could + # introduce severe problems + if self._cw.is_request: + for attr in self._cw.get_shared_data('%s.dont-cache-attrs' % self.eid, + default=(), txdata=True, pop=True): + attrcache.pop(attr, None) + self.cw_attr_cache.pop(attr, None) self.cw_attr_cache.update(attrcache) def _cw_dont_cache_attribute(self, attr): diff -r 552de9f0c46d -r c09feae04094 req.py --- a/req.py Thu Aug 02 19:00:22 2012 +0200 +++ b/req.py Fri Aug 03 13:29:37 2012 +0200 @@ -62,6 +62,8 @@ :attribute vreg.schema: the instance's schema :attribute vreg.config: the instance's configuration """ + is_request = True # False for repository session + def __init__(self, vreg): self.vreg = vreg try: diff -r 552de9f0c46d -r c09feae04094 server/session.py --- a/server/session.py Thu Aug 02 19:00:22 2012 +0200 +++ b/server/session.py Fri Aug 03 13:29:37 2012 +0200 @@ -241,6 +241,7 @@ :attr:`running_dbapi_query`, boolean flag telling if the executing query is coming from a dbapi connection or is a query from within the repository """ + is_request = False is_internal_session = False def __init__(self, user, repo, cnxprops=None, _id=None):