# HG changeset patch # User Aurelien Campeas # Date 1402404276 -7200 # Node ID d551d0a162d51a5ac47bc232236111fc89018555 # Parent 59a79300f213c92780747f677e35c98cb5e43976 [web/sessions] reduce repoapi usage where possible Using session.new_cnx() should be the new preferred way. Related to #3837233. diff -r 59a79300f213 -r d551d0a162d5 web/views/sessions.py --- a/web/views/sessions.py Tue Jun 10 18:17:07 2014 +0200 +++ b/web/views/sessions.py Tue Jun 10 14:44:36 2014 +0200 @@ -1,4 +1,4 @@ -# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of CubicWeb. @@ -27,7 +27,6 @@ BadConnectionId) from cubicweb.web import InvalidSession, Redirect from cubicweb.web.application import AbstractSessionManager -from cubicweb import repoapi class InMemoryRepositorySessionManager(AbstractSessionManager): @@ -96,8 +95,7 @@ # XXX should properly detect missing permission / non writeable source # and avoid "except (RepositoryError, Unauthorized)" below try: - cnx = repoapi.Connection(session) - with cnx: + with session.new_cnx() as cnx: cnx.execute('SET X last_login_time NOW WHERE X eid %(x)s', {'x' : session.user.eid}) cnx.commit()