From 4e32d724c47983c743ea9bd2bbefbe7cb070d989 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Tue, 23 Feb 2021 18:41:49 +0100 Subject: [PATCH] fix storing profiles --- owrx/controllers/settings/sdr.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/owrx/controllers/settings/sdr.py b/owrx/controllers/settings/sdr.py index 855355b..a044e15 100644 --- a/owrx/controllers/settings/sdr.py +++ b/owrx/controllers/settings/sdr.py @@ -62,15 +62,16 @@ class SdrFormController(SettingsFormController, metaclass=ABCMeta): # need to overwrite the existing key in the config since the layering won't capture the changes otherwise config = Config.get() sdrs = config["sdrs"] - sdrs[self.device_id] = self.getData() + sdrs[self.device_id] = self.device config["sdrs"] = sdrs super().store() def _get_device(self): + config = Config.get() device_id = unquote(self.request.matches.group(1)) - if device_id not in Config.get()["sdrs"]: + if device_id not in config["sdrs"]: return None - return device_id, Config.get()["sdrs"][device_id] + return device_id, config["sdrs"][device_id] class SdrDeviceController(SdrFormController): @@ -137,12 +138,12 @@ class SdrProfileController(SdrFormController): return self.profile def _get_profile(self): + if self.device is None: + return None profile_id = unquote(self.request.matches.group(2)) - if self.device_id not in Config.get()["sdrs"]: + if profile_id not in self.device["profiles"]: return None - if profile_id not in Config.get()["sdrs"][self.device_id]["profiles"]: - return None - return profile_id, Config.get()["sdrs"][self.device_id]["profiles"][profile_id] + return profile_id, self.device["profiles"][profile_id] def getSections(self): try: