server/repository.py
changeset 9623 2171da5b9234
parent 9622 637a12b0d3a2
child 9629 8114bed10e78
--- a/server/repository.py	Wed Apr 02 12:38:02 2014 +0200
+++ b/server/repository.py	Thu Apr 03 18:09:57 2014 +0200
@@ -823,10 +823,11 @@
 
     def close(self, sessionid, txid=None, checkshuttingdown=True):
         """close the session with the given id"""
-        session = self._get_session(sessionid, setcnxset=True, txid=txid,
+        session = self._get_session(sessionid, txid=txid,
                                     checkshuttingdown=checkshuttingdown)
         # operation uncommited before close are rolled back before hook is called
-        session._cnx.rollback(free_cnxset=False)
+        if session._cnx._session_handled:
+            session._cnx.rollback(free_cnxset=False)
         with session.new_cnx() as cnx:
             self.hm.call_hooks('session_close', cnx)
             # commit connection at this point in case write operation has been