pyramid_cubicweb/core.py
changeset 11500 8e4935a1848b
parent 11498 a8aaff87c1fc
child 11502 e4682c567e86
equal deleted inserted replaced
11499:60a504740951 11500:8e4935a1848b
   123     cnx.__enter__()
   123     cnx.__enter__()
   124     return cnx
   124     return cnx
   125 
   125 
   126 
   126 
   127 def _cw_close_session(request):
   127 def _cw_close_session(request):
   128     request.cw_session.close()
   128     # XXX Closing the session will actually depend on the cubicweb version.
       
   129     # The following code is correct for cw-3.19.
       
   130     # Later versions will have the notion of detached sessions that should not
       
   131     # need explicit closing, or at least not a repository-related one.
       
   132     request.registry['cubicweb.repository'].close(request.cw_session.sessionid)
   129 
   133 
   130 
   134 
   131 def _cw_session(request):
   135 def _cw_session(request):
   132     """Obtains a cw session from a pyramid request"""
   136     """Obtains a cw session from a pyramid request"""
   133     repo = request.registry['cubicweb.repository']
   137     repo = request.registry['cubicweb.repository']