diff -r 9ea50837bc58 -r b48020a80dc3 cubicweb/web/application.py --- a/cubicweb/web/application.py Wed Oct 05 10:17:39 2016 +0200 +++ b/cubicweb/web/application.py Mon Jun 06 15:26:49 2016 +0200 @@ -51,9 +51,9 @@ def anonymized_request(req): orig_cnx = req.cnx anon_cnx = anonymous_cnx(orig_cnx.session.repo) - req.set_cnx(anon_cnx) try: with anon_cnx: + req.set_cnx(anon_cnx) yield req finally: req.set_cnx(orig_cnx) @@ -262,9 +262,10 @@ try: try: session = self.get_session(req) - from cubicweb import repoapi - cnx = repoapi.Connection(session) - req.set_cnx(cnx) + cnx = session.new_cnx() + with cnx: # may need an open connection to access to e.g. properties + req.set_cnx(cnx) + cnx._open = None # XXX needed to reuse it a few line later :'( except AuthenticationError: # Keep the dummy session set at initialisation. such session will work to some # extend but raise an AuthenticationError on any database access.