From 7c1960768777257a75549d4e517b7b7c249a15d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 21 Nov 2016 14:09:38 +0100 Subject: [PATCH] `chats` must be provided as dict on settings Otherwise, if anonymously loaded first, bindings will be generated differently. See foosel/OctoPrint#1567 for related discussion --- octoprint_telegram/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/octoprint_telegram/__init__.py b/octoprint_telegram/__init__.py index 41c4e5f..66ecb23 100644 --- a/octoprint_telegram/__init__.py +++ b/octoprint_telegram/__init__.py @@ -762,10 +762,10 @@ def on_settings_load(self): data = octoprint.plugin.SettingsPlugin.on_settings_load(self) # only return our restricted settings to admin users - this is only needed for OctoPrint <= 1.2.16 - restricted = ("token", "tracking_token", "chats") - for r in restricted: + restricted = (("token", None), ("tracking_token", None), ("chats", dict()) + for r, v in restricted: if r in data and (current_user is None or current_user.is_anonymous() or not current_user.is_admin()): - data[r] = None + data[r] = v return data