equal
deleted
inserted
replaced
1 from six import text_type |
|
2 |
|
3 from cubicweb.pyramid.test import PyramidCWTest |
1 from cubicweb.pyramid.test import PyramidCWTest |
4 from cubicweb.pyramid import tools |
2 from cubicweb.pyramid import tools |
5 |
3 |
6 |
4 |
7 def set_language(request): |
5 def set_language(request): |
9 cnx = request.cw_cnx |
7 cnx = request.cw_cnx |
10 if lang is None: |
8 if lang is None: |
11 cnx.execute('DELETE CWProperty X WHERE X for_user U, U eid %(u)s', |
9 cnx.execute('DELETE CWProperty X WHERE X for_user U, U eid %(u)s', |
12 {'u': cnx.user.eid}) |
10 {'u': cnx.user.eid}) |
13 else: |
11 else: |
14 cnx.user.set_property(u'ui.language', text_type(lang)) |
12 cnx.user.set_property(u'ui.language', lang) |
15 cnx.commit() |
13 cnx.commit() |
16 |
14 |
17 request.response.text = text_type(cnx.user.properties.get('ui.language', '')) |
15 request.response.text = cnx.user.properties.get('ui.language', '') |
18 return request.response |
16 return request.response |
19 |
17 |
20 |
18 |
21 def add_remove_group(request): |
19 def add_remove_group(request): |
22 add_remove = request.POST['add_remove'] |
20 add_remove = request.POST['add_remove'] |
27 else: |
25 else: |
28 cnx.execute('DELETE U in_group G WHERE G name "users", U eid %(u)s', |
26 cnx.execute('DELETE U in_group G WHERE G name "users", U eid %(u)s', |
29 {'u': cnx.user.eid}) |
27 {'u': cnx.user.eid}) |
30 cnx.commit() |
28 cnx.commit() |
31 |
29 |
32 request.response.text = text_type(','.join(sorted(cnx.user.groups))) |
30 request.response.text = ','.join(sorted(cnx.user.groups)) |
33 return request.response |
31 return request.response |
34 |
32 |
35 |
33 |
36 class SessionSyncHoooksTC(PyramidCWTest): |
34 class SessionSyncHoooksTC(PyramidCWTest): |
37 |
35 |