[selectors] EClassSelector (eg is_instance & all) should check for None value (possible w/ outer join) when a row is specified. Closes #2033165
--- a/selectors.py Fri Oct 21 09:23:43 2011 +0200
+++ b/selectors.py Fri Oct 21 10:59:57 2011 +0200
@@ -303,7 +303,7 @@
else:
etype = rset.description[row][col]
# may have None in rset.description on outer join
- if etype is None:
+ if etype is None or rset.rows[row][col] is None:
return 0
etypes = (etype,)
score = 0
--- a/test/unittest_selectors.py Fri Oct 21 09:23:43 2011 +0200
+++ b/test/unittest_selectors.py Fri Oct 21 10:59:57 2011 +0200
@@ -164,6 +164,12 @@
self.assertEqual(is_instance('BaseTransition').score_class(cls, self.request()),
3)
+ def test_outer_join(self):
+ req = self.request()
+ rset = req.execute('Any U,B WHERE B? bookmarked_by U, U login "anon"')
+ self.assertEqual(is_instance('Bookmark')(None, req, rset=rset, row=0, col=1),
+ 0)
+
class WorkflowSelectorTC(CubicWebTC):
def _commit(self):