From c2ea16221696cc0c5fa56268f252710b3b7eb3a6 Mon Sep 17 00:00:00 2001 From: Sinisa Veseli <sveseli@aps.anl.gov> Date: Fri, 26 Jun 2015 20:10:39 +0000 Subject: [PATCH] fixed issue with invalid session after restart --- src/python/dm/common/client/sessionManager.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/python/dm/common/client/sessionManager.py b/src/python/dm/common/client/sessionManager.py index e99b05b3..63811af1 100755 --- a/src/python/dm/common/client/sessionManager.py +++ b/src/python/dm/common/client/sessionManager.py @@ -13,6 +13,7 @@ import types from dm.common.constants import dmServiceConstants from dm.common.exceptions.configurationError import ConfigurationError from dm.common.exceptions.authorizationError import AuthorizationError +from dm.common.exceptions.invalidSession import InvalidSession from dm.common.exceptions.urlError import UrlError from dm.common.utility.loggingManager import LoggingManager from dm.common.utility.configurationManager import ConfigurationManager @@ -196,7 +197,12 @@ class SessionManager: """ Send session request. """ if self.sessionCookie is None: self.establishSession(self.host, self.username, self.password) - return self.sendRequest(url, method, contentType, data) + try: + return self.sendRequest(url, method, contentType, data) + except InvalidSession, ex: + self.clearSessionFile() + self.establishSession(self.host, self.username, self.password) + return self.sendRequest(url, method, contentType, data) def checkResponseHeadersForErrorsAndSaveSession(self, responseHeaders): try: @@ -204,7 +210,7 @@ class SessionManager: sessionCookie = responseHeaders.get('Set-Cookie') self.saveSession(sessionCookie) return sessionCookie - except AuthorizationError, ex: + except (AuthorizationError, InvalidSession), ex: self.clearSessionFile() raise -- GitLab