# HG changeset patch # User Sylvain Thénault # Date 1312299475 -7200 # Node ID 8d0edec31aafdddb8ad8c45934bf15a626eb6e6e # Parent 5f89f11143bc4a142d23c270225ff5628eb26657 [querier] we should not insert None but skip the line when some unknown eid is detected (closes #1892491) diff -r 5f89f11143bc -r 8d0edec31aaf server/session.py --- a/server/session.py Tue Aug 02 17:31:06 2011 +0200 +++ b/server/session.py Tue Aug 02 17:37:55 2011 +0200 @@ -1180,7 +1180,8 @@ def _build_descr(self, result, basedescription, todetermine): description = [] etype_from_eid = self.describe - for row in result: + todel = [] + for i, row in enumerate(result): row_descr = basedescription[:] for index, isfinal in todetermine: value = row[index] @@ -1194,10 +1195,14 @@ try: row_descr[index] = etype_from_eid(value)[0] except UnknownEid: - self.critical('wrong eid %s in repository, you should ' - 'db-check the database' % value) - row_descr[index] = row[index] = None - description.append(tuple(row_descr)) + 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 ############################################################### diff -r 5f89f11143bc -r 8d0edec31aaf server/test/unittest_session.py --- a/server/test/unittest_session.py Tue Aug 02 17:31:06 2011 +0200 +++ b/server/test/unittest_session.py Tue Aug 02 17:37:55 2011 +0200 @@ -78,5 +78,15 @@ self.assertEqual(session._tx_data, {}) self.assertEqual(session.cnxset, None) + def test_build_descr(self): + rset = self.execute('(Any U,L WHERE U login L) UNION (Any G,N WHERE G name N, G is CWGroup)') + orig_length = len(rset) + rset.rows[0][0] = 9999999 + description = self.session.build_description(rset.syntax_tree(), None, rset.rows) + self.assertEqual(len(description), orig_length - 1) + self.assertEqual(len(rset.rows), orig_length - 1) + self.failIf(rset.rows[0][0] == 9999999) + + if __name__ == '__main__': unittest_main()