server/session.py
branchstable
changeset 5069 135c5d7b89d0
parent 5046 d010f749c21d
child 5074 bc481dab93d4
equal deleted inserted replaced
5068:10c3422d7419 5069:135c5d7b89d0
    19 from yams import BASE_TYPES
    19 from yams import BASE_TYPES
    20 
    20 
    21 from cubicweb import Binary, UnknownEid, schema
    21 from cubicweb import Binary, UnknownEid, schema
    22 from cubicweb.req import RequestSessionBase
    22 from cubicweb.req import RequestSessionBase
    23 from cubicweb.dbapi import ConnectionProperties
    23 from cubicweb.dbapi import ConnectionProperties
    24 from cubicweb.utils import make_uid
    24 from cubicweb.utils import make_uid, RepeatList
    25 from cubicweb.rqlrewrite import RQLRewriter
    25 from cubicweb.rqlrewrite import RQLRewriter
    26 
    26 
    27 ETYPE_PYOBJ_MAP[Binary] = 'Bytes'
    27 ETYPE_PYOBJ_MAP[Binary] = 'Bytes'
    28 
    28 
    29 NO_UNDO_TYPES = schema.SCHEMA_TYPES.copy()
    29 NO_UNDO_TYPES = schema.SCHEMA_TYPES.copy()
   827         if len(rqlst.children) == 1 and len(rqlst.children[0].solutions) == 1:
   827         if len(rqlst.children) == 1 and len(rqlst.children[0].solutions) == 1:
   828             # easy, all lines are identical
   828             # easy, all lines are identical
   829             selected = rqlst.children[0].selection
   829             selected = rqlst.children[0].selection
   830             solution = rqlst.children[0].solutions[0]
   830             solution = rqlst.children[0].solutions[0]
   831             description = _make_description(selected, args, solution)
   831             description = _make_description(selected, args, solution)
   832             return [tuple(description)] * len(result)
   832             return RepeatList(len(result), tuple(description))
   833         # hard, delegate the work :o)
   833         # hard, delegate the work :o)
   834         return self.manual_build_descr(rqlst, args, result)
   834         return self.manual_build_descr(rqlst, args, result)
   835 
   835 
   836     def manual_build_descr(self, rqlst, args, result):
   836     def manual_build_descr(self, rqlst, args, result):
   837         """build a description for a given result by analysing each row
   837         """build a description for a given result by analysing each row
   856             else:
   856             else:
   857                 # sample etype
   857                 # sample etype
   858                 etype = rqlst.children[0].solutions[0]
   858                 etype = rqlst.children[0].solutions[0]
   859                 basedescription.append(term.get_type(etype, args))
   859                 basedescription.append(term.get_type(etype, args))
   860         if not todetermine:
   860         if not todetermine:
   861             return [tuple(basedescription)] * len(result)
   861             return RepeatList(len(result), tuple(basedescription))
   862         return self._build_descr(result, basedescription, todetermine)
   862         return self._build_descr(result, basedescription, todetermine)
   863 
   863 
   864     def _build_descr(self, result, basedescription, todetermine):
   864     def _build_descr(self, result, basedescription, todetermine):
   865         description = []
   865         description = []
   866         etype_from_eid = self.describe
   866         etype_from_eid = self.describe