confighelper: don't warn on valid sections without options

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-03-04 21:15:30 -05:00
parent 84f663e2bc
commit c8a2aa7a6c
1 changed files with 3 additions and 1 deletions

View File

@ -21,6 +21,8 @@ class ConfigHelper:
self.section = section self.section = section
self.orig_sections = orig_sects self.orig_sections = orig_sects
self.parsed = parsed self.parsed = parsed
if self.section not in self.parsed:
self.parsed[self.section] = {}
self.sections = config.sections self.sections = config.sections
self.has_section = config.has_section self.has_section = config.has_section
@ -60,7 +62,7 @@ class ConfigHelper:
f"No option found ({option}) in section [{self.section}]") f"No option found ({option}) in section [{self.section}]")
if self.section in self.orig_sections: if self.section in self.orig_sections:
# Only track sections included in the original config # Only track sections included in the original config
self.parsed.setdefault(self.section, {})[option] = val self.parsed[self.section][option] = val
return val return val
def get(self, option, default=Sentinel): def get(self, option, default=Sentinel):