# HG changeset patch # User David Douard # Date 1435925217 -7200 # Node ID 12bc4e92aa628e0be729fb8a9f3975eb057fd471 # Parent e95b559a06a28022ecac1c09bd5416c8c24f7e3a [predicates] objectify the anonymous_user predicate for the sake of consistency. diff -r e95b559a06a2 -r 12bc4e92aa62 predicates.py --- a/predicates.py Thu Jul 02 19:54:25 2015 +0200 +++ b/predicates.py Fri Jul 03 14:06:57 2015 +0200 @@ -1299,6 +1299,7 @@ return 1 return 0 + @objectify_predicate def authenticated_user(cls, req, **kwargs): """Return 1 if the user is authenticated (i.e. not the anonymous user). @@ -1310,13 +1311,16 @@ return 1 -# XXX == ~ authenticated_user() -def anonymous_user(): +@objectify_predicate +def anonymous_user(cls, req, **kwargs): """Return 1 if the user is not authenticated (i.e. is the anonymous user). May only be used on the web side, not on the data repository side. """ - return ~ authenticated_user() + if req.session.anonymous_session: + return 1 + return 0 + class match_user_groups(ExpectedValuePredicate): """Return a non-zero score if request's user is in at least one of the