diff -r c323ff08ad35 -r 6718ba5db0eb selectors.py --- 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.