diff -r 3d049071957e -r 6e5d8512b07d server/session.py --- a/server/session.py Tue Sep 11 21:51:54 2012 +0200 +++ b/server/session.py Tue Sep 11 22:32:01 2012 +0200 @@ -1107,71 +1107,6 @@ self._threaddata._rewriter = RQLRewriter(self) return self._threaddata._rewriter - def build_description(self, rqlst, args, result): - """build a description for a given result""" - if len(rqlst.children) == 1 and len(rqlst.children[0].solutions) == 1: - # easy, all lines are identical - selected = rqlst.children[0].selection - solution = rqlst.children[0].solutions[0] - description = _make_description(selected, args, solution) - return RepeatList(len(result), tuple(description)) - # hard, delegate the work :o) - return self.manual_build_descr(rqlst, args, result) - - def manual_build_descr(self, rqlst, args, result): - """build a description for a given result by analysing each row - - XXX could probably be done more efficiently during execution of query - """ - # not so easy, looks for variable which changes from one solution - # to another - unstables = rqlst.get_variable_indices() - basedescr = [] - todetermine = [] - for i in xrange(len(rqlst.children[0].selection)): - ttype = selection_idx_type(i, rqlst, args) - if ttype is None or ttype == 'Any': - ttype = None - isfinal = True - else: - isfinal = ttype in BASE_TYPES - if ttype is None or i in unstables: - basedescr.append(None) - todetermine.append( (i, isfinal) ) - else: - basedescr.append(ttype) - if not todetermine: - return RepeatList(len(result), tuple(basedescr)) - return self._build_descr(result, basedescr, todetermine) - - def _build_descr(self, result, basedescription, todetermine): - description = [] - etype_from_eid = self.describe - todel = [] - for i, row in enumerate(result): - row_descr = basedescription[:] - for index, isfinal in todetermine: - value = row[index] - if value is None: - # None value inserted by an outer join, no type - row_descr[index] = None - continue - if isfinal: - row_descr[index] = etype_from_pyobj(value) - else: - try: - row_descr[index] = etype_from_eid(value)[0] - except UnknownEid: - self.error('wrong eid %s in repository, you should ' - 'db-check the database' % value) - todel.append(i) - break - else: - description.append(tuple(row_descr)) - for i in reversed(todel): - del result[i] - return description - # deprecated ############################################################### @deprecated('[3.13] use getattr(session.rtype_eids_rdef(rtype, eidfrom, eidto), prop)')