From 786e2f860f867b9c428fc00ea27fe0fd2c324186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 22 Sep 2020 16:31:09 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20remove=20should=20behave=20the?= =?UTF-8?q?=20same=20as=20set=20and=20get=20regarding=20defaults?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/settings.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 44d26a480..d4a3c4e8e 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -1654,15 +1654,20 @@ class Settings(object): #~~ remove - def remove(self, path, config=None, error_on_path=False): + def remove(self, path, config=None, error_on_path=False, defaults=None): if not path: if error_on_path: raise NoSuchSettingsPath() return - if config is not None: - mappings = [config] + self._overlay_maps + [self._default_map] - chain = HierarchicalChainMap(*mappings) + if config is not None or defaults is not None: + if config is None: + config = self._config + + if defaults is None: + defaults = dict(self._map.parents) + + chain = HierarchicalChainMap(config, defaults) else: chain = self._map