selectors.py
branchstable
changeset 5502 c342531032a1
parent 5490 b7b96b8decf1
child 5508 6718ba5db0eb
child 5608 f9ab62103ad4
--- a/selectors.py	Fri May 07 16:50:09 2010 +0200
+++ b/selectors.py	Fri May 07 20:07:54 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):