server/repository.py
branchstable
changeset 1939 67e7379edd96
parent 1883 011e13d74cfc
child 1954 9b20f3504af8
--- a/server/repository.py	Tue May 26 09:31:15 2009 +0200
+++ b/server/repository.py	Tue May 26 11:01:23 2009 +0200
@@ -636,9 +636,10 @@
             self.exception('unexpected error')
             raise
 
-    def close(self, sessionid):
+    def close(self, sessionid, checkshuttingdown=True):
         """close the session with the given id"""
-        session = self._get_session(sessionid, setpool=True)
+        session = self._get_session(sessionid, setpool=True,
+                                    checkshuttingdown=checkshuttingdown)
         # operation uncommited before close are rollbacked before hook is called
         session.rollback()
         self.hm.call_hooks('session_close', session=session)
@@ -691,7 +692,7 @@
         """close every opened sessions"""
         for sessionid in self._sessions.keys():
             try:
-                self.close(sessionid)
+                self.close(sessionid, checkshuttingdown=False)
             except:
                 self.exception('error while closing session %s' % sessionid)
 
@@ -720,9 +721,9 @@
         session.set_pool()
         return session
 
-    def _get_session(self, sessionid, setpool=False):
+    def _get_session(self, sessionid, setpool=False, checkshuttingdown=True):
         """return the user associated to the given session identifier"""
-        if self._shutting_down:
+        if checkshuttingdown and self._shutting_down:
             raise Exception('Repository is shutting down')
         try:
             session = self._sessions[sessionid]