From 1cbc3229048a1a66c2a4249e966a4f34173fcb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 17 Sep 2020 18:23:09 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20settings=20overlays?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Defaults were not being merged --- src/octoprint/settings.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 2a3c9b36b..73b697dfe 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -475,7 +475,7 @@ class HierarchicalChainMap(ChainMap): except KeyError: return False - def get_by_path(self, path, only_local=False, only_defaults=False): + def get_by_path(self, path, only_local=False, only_defaults=False, merged=False): if only_defaults: current = self.parents elif only_local: @@ -490,6 +490,8 @@ class HierarchicalChainMap(ChainMap): else: raise KeyError(key) + if merged: + current = current.deep_dict() return current[path[-1]] def set_by_path(self, path, value): @@ -1448,7 +1450,7 @@ class Settings(object): if isinstance(value, dict) and merged: try: - default_value = chain.get_by_path(parent_path + [key], only_defaults=True) + default_value = chain.get_by_path(parent_path + [key], only_defaults=True, merged=True) if default_value is not None: value = dict_merge(default_value, value) except KeyError: