pyramid_cubicweb/bwcompat.py
changeset 11575 97110b4af42f
parent 11539 ff581d66f682
child 11578 fcba04437236
--- a/pyramid_cubicweb/bwcompat.py	Tue May 19 08:38:08 2015 +0200
+++ b/pyramid_cubicweb/bwcompat.py	Wed Apr 29 22:46:17 2015 +0200
@@ -110,8 +110,12 @@
             # that is accessible by the pyramid views
             headers = security.forget(request)
             raise HTTPSeeOther(ex.url, headers=headers)
-        # except AuthenticationError:
-        # XXX I don't think it makes sens to catch this ex here (cdevienne)
+        except cubicweb.AuthenticationError:
+            # Will occur upon access to req.cnx which is a
+            # cubicweb.dbapi._NeedAuthAccessMock.
+            if not content:
+                content = vreg['views'].main_template(req, 'login')
+                request.response.body = content
 
         return request.response