# HG changeset patch # User Sylvain Thénault # Date 1490867769 -7200 # Node ID 1d3a9bb46339d3e9dc30f5403c3e6fd950954b13 # Parent 392d6d5992865c75a776c4442275611c796473d6 [session] Avoid deprecation warning on access to Connection.data this attribute has been deprecated during the session related rework, remove warning by explicitly storing data in .transaction_data since session data is not anymore reachable through Connection object. This will allows simplification of session synchronization hooks in a later cset. Also since we do not rely anymore on session data here, we may at some point rewrite those properties to rely on the ORM instead of such custom caching. diff -r 392d6d599286 -r 1d3a9bb46339 cubicweb/devtools/repotest.py --- a/cubicweb/devtools/repotest.py Thu Mar 30 10:43:49 2017 +0200 +++ b/cubicweb/devtools/repotest.py Thu Mar 30 11:56:09 2017 +0200 @@ -251,7 +251,7 @@ # use cnx.user.eid to get correct owned_by relation, unless explicit eid with self.admin_access.cnx() as cnx: user_eid = cnx.user.eid - cnx.user._cw.data[user_session_cache_key(user_eid, 'groups')] = set(groups) + cnx.user._cw.transaction_data[user_session_cache_key(user_eid, 'groups')] = set(groups) yield cnx def qexecute(self, rql, args=None, build_descr=True): diff -r 392d6d599286 -r 1d3a9bb46339 cubicweb/entities/authobjs.py --- a/cubicweb/entities/authobjs.py Thu Mar 30 10:43:49 2017 +0200 +++ b/cubicweb/entities/authobjs.py Thu Mar 30 11:56:09 2017 +0200 @@ -62,26 +62,26 @@ def groups(self): key = user_session_cache_key(self.eid, 'groups') try: - return self._cw.data[key] + return self._cw.transaction_data[key] except KeyError: with self._cw.security_enabled(read=False): groups = set(group for group, in self._cw.execute( 'Any GN WHERE U in_group G, G name GN, U eid %(userid)s', {'userid': self.eid})) - self._cw.data[key] = groups + self._cw.transaction_data[key] = groups return groups @property def properties(self): key = user_session_cache_key(self.eid, 'properties') try: - return self._cw.data[key] + return self._cw.transaction_data[key] except KeyError: with self._cw.security_enabled(read=False): properties = dict(self._cw.execute( 'Any K, V WHERE P for_user U, U eid %(userid)s, ' 'P pkey K, P value V', {'userid': self.eid})) - self._cw.data[key] = properties + self._cw.transaction_data[key] = properties return properties def prefered_language(self, language=None):