29 from rql.nodes import (Relation, VariableRef, Constant, SubQuery, Function, |
29 from rql.nodes import (Relation, VariableRef, Constant, SubQuery, Function, |
30 Exists, Not) |
30 Exists, Not) |
31 from yams import BASE_TYPES |
31 from yams import BASE_TYPES |
32 |
32 |
33 from cubicweb import ValidationError, Unauthorized, QueryError, UnknownEid |
33 from cubicweb import ValidationError, Unauthorized, QueryError, UnknownEid |
34 from cubicweb import Binary, server, typed_eid |
34 from cubicweb import Binary, server |
35 from cubicweb.rset import ResultSet |
35 from cubicweb.rset import ResultSet |
36 |
36 |
37 from cubicweb.utils import QueryCache, RepeatList |
37 from cubicweb.utils import QueryCache, RepeatList |
38 from cubicweb.server.utils import cleanup_solutions |
38 from cubicweb.server.utils import cleanup_solutions |
39 from cubicweb.server.rqlannotation import SQLGenAnnotator, set_qdata |
39 from cubicweb.server.rqlannotation import SQLGenAnnotator, set_qdata |
389 varkwargs = {} |
389 varkwargs = {} |
390 if not session.transaction_data.get('security-rqlst-cache'): |
390 if not session.transaction_data.get('security-rqlst-cache'): |
391 for var in rqlst.defined_vars.itervalues(): |
391 for var in rqlst.defined_vars.itervalues(): |
392 if var.stinfo['constnode'] is not None: |
392 if var.stinfo['constnode'] is not None: |
393 eid = var.stinfo['constnode'].eval(self.args) |
393 eid = var.stinfo['constnode'].eval(self.args) |
394 varkwargs[var.name] = typed_eid(eid) |
394 varkwargs[var.name] = int(eid) |
395 # dictionary of variables restricted for security reason |
395 # dictionary of variables restricted for security reason |
396 localchecks = {} |
396 localchecks = {} |
397 restricted_vars = set() |
397 restricted_vars = set() |
398 newsolutions = [] |
398 newsolutions = [] |
399 for solution in rqlst.solutions: |
399 for solution in rqlst.solutions: |
561 edited_entities = {} |
561 edited_entities = {} |
562 relations = {} |
562 relations = {} |
563 for subj, rtype, obj in self.relation_defs(): |
563 for subj, rtype, obj in self.relation_defs(): |
564 # if a string is given into args instead of an int, we get it here |
564 # if a string is given into args instead of an int, we get it here |
565 if isinstance(subj, basestring): |
565 if isinstance(subj, basestring): |
566 subj = typed_eid(subj) |
566 subj = int(subj) |
567 elif not isinstance(subj, (int, long)): |
567 elif not isinstance(subj, (int, long)): |
568 subj = subj.entity.eid |
568 subj = subj.entity.eid |
569 if isinstance(obj, basestring): |
569 if isinstance(obj, basestring): |
570 obj = typed_eid(obj) |
570 obj = int(obj) |
571 elif not isinstance(obj, (int, long)): |
571 elif not isinstance(obj, (int, long)): |
572 obj = obj.entity.eid |
572 obj = obj.entity.eid |
573 if repo.schema.rschema(rtype).inlined: |
573 if repo.schema.rschema(rtype).inlined: |
574 if subj not in edited_entities: |
574 if subj not in edited_entities: |
575 entity = session.entity_from_eid(subj) |
575 entity = session.entity_from_eid(subj) |