31 from rql import CoercionError |
31 from rql import CoercionError |
32 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj |
32 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj |
33 from yams import BASE_TYPES |
33 from yams import BASE_TYPES |
34 |
34 |
35 from cubicweb import Binary, UnknownEid, QueryError, schema |
35 from cubicweb import Binary, UnknownEid, QueryError, schema |
|
36 from cubicweb.selectors import objectify_selector |
36 from cubicweb.req import RequestSessionBase |
37 from cubicweb.req import RequestSessionBase |
37 from cubicweb.dbapi import ConnectionProperties |
38 from cubicweb.dbapi import ConnectionProperties |
38 from cubicweb.utils import make_uid, RepeatList |
39 from cubicweb.utils import make_uid, RepeatList |
39 from cubicweb.rqlrewrite import RQLRewriter |
40 from cubicweb.rqlrewrite import RQLRewriter |
40 from cubicweb.server.edition import EditedEntity |
41 from cubicweb.server.edition import EditedEntity |
|
42 |
41 |
43 |
42 ETYPE_PYOBJ_MAP[Binary] = 'Bytes' |
44 ETYPE_PYOBJ_MAP[Binary] = 'Bytes' |
43 |
45 |
44 NO_UNDO_TYPES = schema.SCHEMA_TYPES.copy() |
46 NO_UNDO_TYPES = schema.SCHEMA_TYPES.copy() |
45 NO_UNDO_TYPES.add('CWCache') |
47 NO_UNDO_TYPES.add('CWCache') |
55 """return a description for a result set""" |
57 """return a description for a result set""" |
56 description = [] |
58 description = [] |
57 for term in selected: |
59 for term in selected: |
58 description.append(term.get_type(solution, args)) |
60 description.append(term.get_type(solution, args)) |
59 return description |
61 return description |
|
62 |
|
63 @objectify_selector |
|
64 def is_user_session(cls, req, **kwargs): |
|
65 """repository side only selector returning 1 if the session is a regular |
|
66 user session and not an internal session |
|
67 """ |
|
68 return not req.is_internal_session |
|
69 |
|
70 @objectify_selector |
|
71 def is_internal_session(cls, req, **kwargs): |
|
72 """repository side only selector returning 1 if the session is not a regular |
|
73 user session but an internal session |
|
74 """ |
|
75 return req.is_internal_session |
60 |
76 |
61 |
77 |
62 class hooks_control(object): |
78 class hooks_control(object): |
63 """context manager to control activated hooks categories. |
79 """context manager to control activated hooks categories. |
64 |
80 |