[PATCH 02 of 13 saem_ref] [pviews] Proper way to detect anonymous session

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Mar 31 17:57:14 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490362072 -3600
#      Fri Mar 24 14:27:52 2017 +0100
# Node ID 76820a8b9c7416705b6cd5cd0a5fa4ab974d42dd
# Parent  540baa95ddfd9b39f065737504db396e8e117167
[pviews] Proper way to detect anonymous session

diff --git a/cubicweb_saem_ref/pviews.py b/cubicweb_saem_ref/pviews.py
--- a/cubicweb_saem_ref/pviews.py
+++ b/cubicweb_saem_ref/pviews.py
@@ -30,11 +30,11 @@ from cubicweb_eac import dataimport
     accept='application/json',
     renderer='json',
 )
 def eac_import(request):
     cnx = request.cw_cnx
-    if cnx.anonymous_connection:
+    if cnx.session.anonymous_session:
         request.response.status_int = 401
         return {'error': 'This service requires authentication.'}
     if cnx.user.naa is None:
         request.response.status_int = 403
         return {'error': 'Authenticated user is not linked to an organisation, '


More information about the saem-devel mailing list