[selectors] one_line_rset selector should also work when rset is None but an entity is specified stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 27 Jan 2011 13:41:00 +0100
branchstable
changeset 6905 fe9fd048e64c
parent 6904 cf869016a823
child 6906 5f13aefb470b
[selectors] one_line_rset selector should also work when rset is None but an entity is specified
selectors.py
--- a/selectors.py	Thu Jan 27 13:40:01 2011 +0100
+++ b/selectors.py	Thu Jan 27 13:41:00 2011 +0100
@@ -551,6 +551,8 @@
     """Return 1 if the result set is of size 1, or greater but a specific row in
       the result set is specified ('row' argument).
     """
+    if rset is None and 'entity' in kwargs:
+        return 1
     if rset is not None and (row is not None or rset.rowcount == 1):
         return 1
     return 0