Allow completely empty config files.
- Previous version would give validation error for an empty file. Now this is properly ignored. - Also includes bugfix in ConfigFormatError
This commit is contained in:
parent
8d6342c53d
commit
ad32f64ef6
@ -357,8 +357,8 @@ def _read_config_file(filename, schema):
|
|||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
data = syaml.load(f)
|
data = syaml.load(f)
|
||||||
|
|
||||||
validate_section(data, schema)
|
if data:
|
||||||
|
validate_section(data, schema)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
except MarkedYAMLError, e:
|
except MarkedYAMLError, e:
|
||||||
@ -514,7 +514,7 @@ def __init__(self, validation_error, data):
|
|||||||
# Try really hard to get the parent (which sometimes is not
|
# Try really hard to get the parent (which sometimes is not
|
||||||
# set) This digs it out of the validated structure if it's not
|
# set) This digs it out of the validated structure if it's not
|
||||||
# on the validation_error.
|
# on the validation_error.
|
||||||
if not parent_mark:
|
if path and not parent_mark:
|
||||||
parent_path = list(path)[:-1]
|
parent_path = list(path)[:-1]
|
||||||
parent = get_path(parent_path, data)
|
parent = get_path(parent_path, data)
|
||||||
if path[-1] in parent:
|
if path[-1] in parent:
|
||||||
|
Loading…
Reference in New Issue
Block a user