configfile: Setup get_status() results after check_unused_options()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-09-04 13:25:11 -04:00
parent 9d11b18db5
commit c89db2480d
1 changed files with 5 additions and 5 deletions

View File

@ -260,7 +260,6 @@ class PrinterConfig:
autosave_data = self._strip_duplicates(autosave_data, regular_config) autosave_data = self._strip_duplicates(autosave_data, regular_config)
self.autosave = self._build_config_wrapper(autosave_data, filename) self.autosave = self._build_config_wrapper(autosave_data, filename)
cfg = self._build_config_wrapper(regular_data + autosave_data, filename) cfg = self._build_config_wrapper(regular_data + autosave_data, filename)
self._build_status(cfg)
return cfg return cfg
def check_unused_options(self, config): def check_unused_options(self, config):
fileconfig = config.fileconfig fileconfig = config.fileconfig
@ -282,10 +281,8 @@ class PrinterConfig:
if (section, option) not in access_tracking: if (section, option) not in access_tracking:
raise error("Option '%s' is not valid in section '%s'" raise error("Option '%s' is not valid in section '%s'"
% (option, section)) % (option, section))
# Setup self.status_settings # Setup get_status()
self.status_settings = {} self._build_status(config)
for (section, option), value in config.access_tracking.items():
self.status_settings.setdefault(section, {})[option] = value
def log_config(self, config): def log_config(self, config):
lines = ["===== Config file =====", lines = ["===== Config file =====",
self._build_config_string(config), self._build_config_string(config),
@ -298,6 +295,9 @@ class PrinterConfig:
self.status_raw_config[section.get_name()] = section_status = {} self.status_raw_config[section.get_name()] = section_status = {}
for option in section.get_prefix_options(''): for option in section.get_prefix_options(''):
section_status[option] = section.get(option, note_valid=False) section_status[option] = section.get(option, note_valid=False)
self.status_settings = {}
for (section, option), value in config.access_tracking.items():
self.status_settings.setdefault(section, {})[option] = value
def get_status(self, eventtime): def get_status(self, eventtime):
return {'config': self.status_raw_config, return {'config': self.status_raw_config,
'settings': self.status_settings, 'settings': self.status_settings,