cubicweb/pyramid/auth.py
changeset 12224 5c066dc7307b
parent 12108 1a5fc93c81db
child 12243 a46fb3f58ea2
--- a/cubicweb/pyramid/auth.py	Mon Oct 30 09:25:22 2017 +0100
+++ b/cubicweb/pyramid/auth.py	Mon Oct 30 09:28:52 2017 +0100
@@ -121,16 +121,16 @@
         return ()
 
     def remember(self, request, principal, **kw):
-        try:
-            repo = request.registry['cubicweb.repository']
-            with repo.internal_cnx() as cnx:
+        repo = request.registry['cubicweb.repository']
+        with repo.internal_cnx() as cnx:
+            try:
                 cnx.execute(
                     "SET U last_login_time %(now)s WHERE U eid %(user)s", {
                         'now': datetime.datetime.now(),
                         'user': principal})
                 cnx.commit()
-        except:
-            log.exception("Failed to update last_login_time")
+            except Exception:
+                log.exception("Failed to update last_login_time")
         return ()
 
     def forget(self, request):