🐛 self._user might not be a SessionUser

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.
This commit is contained in:
Gina Häußge committed 2020-03-03 16:28:10 +01:00
1 parent b818042fc5
commit edfa786514
1 file changed
+1 -1
+1 -1
View File
@@ -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()