From edfa7865140524eb2c1d9d8bc3e6ad8ff0adb2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 3 Mar 2020 16:28:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20self.=5Fuser=20might=20not=20be?= =?UTF-8?q?=20a=20SessionUser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the socket is already logged out it will be an AnonymousUser and thus not a SessionUser. We shouldn't actually be pushing this without a round over an RC but frankly I don't want to postpone the release for two weeks (as next week is kinda busy) just to solve this obvious issue with zero side effects. So here I am doing things I shouldn't. --- src/octoprint/server/util/sockjs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index d65d02426..f051f63a0 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -312,7 +312,7 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection, self._temperatureBacklog.append(data) def on_user_logged_out(self, user, stale=False): - if user.get_id() == self._user.get_id() and hasattr(user, "session") and user.session == self._user.session: + if user.get_id() == self._user.get_id() and hasattr(user, "session") and hasattr(self._user, "session") and user.session == self._user.session: self._logger.info("User {} logged out, logging out on socket".format(user.get_id())) self._on_logout()