configfile: Improve error message when a required option is missing
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ca8e6ad89b
commit
16963a8e1a
|
@ -23,9 +23,11 @@ class ConfigWrapper:
|
||||||
return self.section
|
return self.section
|
||||||
def _get_wrapper(self, parser, option, default, minval=None, maxval=None,
|
def _get_wrapper(self, parser, option, default, minval=None, maxval=None,
|
||||||
above=None, below=None, note_valid=True):
|
above=None, below=None, note_valid=True):
|
||||||
if (default is not sentinel
|
if not self.fileconfig.has_option(self.section, option):
|
||||||
and not self.fileconfig.has_option(self.section, option)):
|
if default is not sentinel:
|
||||||
return default
|
return default
|
||||||
|
raise error("Option '%s' in section '%s' must be specified"
|
||||||
|
% (option, self.section))
|
||||||
if note_valid:
|
if note_valid:
|
||||||
self.access_tracking[(self.section.lower(), option.lower())] = 1
|
self.access_tracking[(self.section.lower(), option.lower())] = 1
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue