# HG changeset patch # User Sylvain Thénault # Date 1482164568 -3600 # Node ID 327585fd7670da516dd5c7bd80a08c96246c4aca # Parent 74e0d1a5560ba8dd28d05dfb1ad376582854442d [pyramid] Don't use unsafe_cnx_context_manager for write queries we may have clumsy error that hide previous problems on attempting to commit the transaction. Closes #16753531 diff -r 74e0d1a5560b -r 327585fd7670 cubicweb/pyramid/session.py --- a/cubicweb/pyramid/session.py Wed Dec 14 08:37:11 2016 +0100 +++ b/cubicweb/pyramid/session.py Mon Dec 19 17:22:48 2016 +0100 @@ -28,6 +28,8 @@ If request has an attached connection, its security will be deactived in the context manager's scope, else a new internal connection is returned. + + This should be used for read-only queries, not if you intend to commit/rollback some data. """ cnx = request.cw_cnx if cnx is None: @@ -134,7 +136,7 @@ data = Binary(pickle.dumps(dict(self))) sessioneid = self.sessioneid - with unsafe_cnx_context_manager(self.request) as cnx: + with self.request.registry['cubicweb.repository'].internal_cnx() as cnx: if not sessioneid: session = cnx.create_entity( 'CWSession', cwsessiondata=data)