selectors.py
changeset 5508 6718ba5db0eb
parent 5480 2d5c46e78ae9
parent 5502 c342531032a1
child 5556 9ab2b4c74baf
--- a/selectors.py	Thu May 06 14:29:07 2010 +0200
+++ b/selectors.py	Mon May 10 16:59:32 2010 +0200
@@ -689,6 +689,16 @@
         return rset and self.match_expected(len(rset.column_types(col))) or 0
 
 
+@objectify_selector
+def logged_user_in_rset(cls, req, rset=None, row=None, col=0, **kwargs):
+    """Return positive score if the result set at the specified row / col
+    contains the eid of the logged user.
+    """
+    if rset is None:
+        return 0
+    return req.user.eid == rset[row or 0][col]
+
+
 # entity selectors #############################################################
 
 class non_final_entity(EClassSelector):
@@ -1052,7 +1062,7 @@
 
 @objectify_selector
 @lltrace
-def no_cnx(cls, req, rset, *args, **kwargs):
+def no_cnx(cls, req, **kwargs):
     """Return 1 if the web session has no connection set. This occurs when
     anonymous access is not allowed and user isn't authenticated.