equal
deleted
inserted
replaced
25 from pprint import pprint |
25 from pprint import pprint |
26 |
26 |
27 from logilab.common.testlib import SkipTest |
27 from logilab.common.testlib import SkipTest |
28 |
28 |
29 from cubicweb.devtools.testlib import RepoAccess |
29 from cubicweb.devtools.testlib import RepoAccess |
30 |
30 from cubicweb.entities.authobjs import user_session_cache_key |
31 |
31 |
32 def tuplify(mylist): |
32 def tuplify(mylist): |
33 return [tuple(item) for item in mylist] |
33 return [tuple(item) for item in mylist] |
34 |
34 |
35 |
35 |
249 def user_groups_session(self, *groups): |
249 def user_groups_session(self, *groups): |
250 """lightweight session using the current user with hi-jacked groups""" |
250 """lightweight session using the current user with hi-jacked groups""" |
251 # use cnx.user.eid to get correct owned_by relation, unless explicit eid |
251 # use cnx.user.eid to get correct owned_by relation, unless explicit eid |
252 with self._access.cnx() as cnx: |
252 with self._access.cnx() as cnx: |
253 user_eid = cnx.user.eid |
253 user_eid = cnx.user.eid |
254 cnx.user._cw.data['groups-%s' % user_eid] = set(groups) |
254 cnx.user._cw.data[user_session_cache_key(user_eid, 'groups')] = set(groups) |
255 yield cnx |
255 yield cnx |
256 |
256 |
257 def qexecute(self, rql, args=None, build_descr=True): |
257 def qexecute(self, rql, args=None, build_descr=True): |
258 with self._access.cnx() as cnx: |
258 with self._access.cnx() as cnx: |
259 try: |
259 try: |