selectors.py
changeset 5223 6abd6e3599f4
parent 5174 78438ad513ca
child 5244 5467674ad101
--- a/selectors.py	Mon Apr 12 14:41:01 2010 +0200
+++ b/selectors.py	Tue Apr 13 12:19:24 2010 +0200
@@ -107,7 +107,7 @@
 	__regid__ = 'loggeduserlink'
 
 	def call(self):
-	    if self._cw.cnx.anonymous_connection:
+	    if self._cw.session.anonymous_session:
 		# display login link
 		...
 	    else:
@@ -1038,12 +1038,24 @@
 
 @objectify_selector
 @lltrace
+def no_cnx(cls, req, rset, *args, **kwargs):
+    """Return 1 if the web session has no connection set. This occurs when
+    anonymous access is not allowed and user isn't authenticated.
+
+    May only be used on the web side, not on the data repository side.
+    """
+    if req.cnx is None:
+        return 1
+    return 0
+
+@objectify_selector
+@lltrace
 def authenticated_user(cls, req, **kwargs):
     """Return 1 if the user is authenticated (e.g. not the anonymous user).
 
     May only be used on the web side, not on the data repository side.
     """
-    if req.cnx.anonymous_connection:
+    if req.session.anonymous_session:
         return 0
     return 1