Fix session closing for cubicweb 3.19
authorChristophe de Vienne <christophe@unlish.com>
Thu, 21 Aug 2014 22:26:42 +0200
changeset 11500 8e4935a1848b
parent 11499 60a504740951
child 11501 fcf7f99fad4a
Fix session closing for cubicweb 3.19 Related to #4291173
pyramid_cubicweb/core.py
--- a/pyramid_cubicweb/core.py	Thu Aug 21 21:43:24 2014 +0200
+++ b/pyramid_cubicweb/core.py	Thu Aug 21 22:26:42 2014 +0200
@@ -125,7 +125,11 @@
 
 
 def _cw_close_session(request):
-    request.cw_session.close()
+    # XXX Closing the session will actually depend on the cubicweb version.
+    # The following code is correct for cw-3.19.
+    # Later versions will have the notion of detached sessions that should not
+    # need explicit closing, or at least not a repository-related one.
+    request.registry['cubicweb.repository'].close(request.cw_session.sessionid)
 
 
 def _cw_session(request):