Browse Source

Avoiding fails at session_restore

Before when session restore fails the webui was answering "Unknown status 200" as content.
Now it produce 2 log messages (maybe)
Yann Weber 8 years ago
parent
commit
629ac94dc8
2 changed files with 6 additions and 7 deletions
  1. 5
    2
      lodel/auth/client.py
  2. 1
    5
      plugins/webui/run.py

+ 5
- 2
lodel/auth/client.py View File

160
         if cls._instance.__session_token is not None:
160
         if cls._instance.__session_token is not None:
161
             raise ClientAuthenticationError("Trying to restore a session, but \
161
             raise ClientAuthenticationError("Trying to restore a session, but \
162
 a session is allready started !!!")
162
 a session is allready started !!!")
163
-        cls._instance.__datas = SessionHandler.restore(token)
164
-        cls._instance.__session_token = token
163
+        try:
164
+            cls._instance.__datas = SessionHandler.restore(token)
165
+            cls._instance.__session_token = token
166
+        except ClientAuthenticationFailure:
167
+            logger.warning("Session restoring fails")
165
         return copy.copy(cls._instance.datas)
168
         return copy.copy(cls._instance.datas)
166
     
169
     
167
     ##@brief Return the current session token or None
170
     ##@brief Return the current session token or None

+ 1
- 5
plugins/webui/run.py View File

71
         #to log messages with client infos
71
         #to log messages with client infos
72
         client = WebUiClient(env['REMOTE_ADDR'], env['HTTP_USER_AGENT'], None)
72
         client = WebUiClient(env['REMOTE_ADDR'], env['HTTP_USER_AGENT'], None)
73
         session_token = load_cookie(request)
73
         session_token = load_cookie(request)
74
-        if session_token is not None:
74
+        if session_token is not None and len(session_token) > 0:
75
             WebUiClient.restore_session(session_token)
75
             WebUiClient.restore_session(session_token)
76
-            #next line is for testing purpose
77
-            print("ACCESS DATAS : ", WebUiClient['last_request'])
78
         session_token = None
76
         session_token = None
79
-        #next line is for testing purpose
80
-        WebUiClient['last_request'] = time.time()
81
         
77
         
82
         try:
78
         try:
83
             controller = get_controller(request)
79
             controller = get_controller(request)

Loading…
Cancel
Save