[enh] better checks on settings.yaml
This commit is contained in:
parent
a816cb1497
commit
7a1bdb033d
@ -12,7 +12,10 @@ def main():
|
|||||||
|
|
||||||
settings = yaml.safe_load("settings.yaml")
|
settings = yaml.safe_load("settings.yaml")
|
||||||
|
|
||||||
|
assert isinstance(settings, dict), "Your settings.yaml should be a dict"
|
||||||
assert settings.get("title"), "You should specify a title in your main settings.yaml"
|
assert settings.get("title"), "You should specify a title in your main settings.yaml"
|
||||||
|
title = settings["title"]
|
||||||
|
sub_title = settings.get("sub_title", "")
|
||||||
|
|
||||||
dirs = filter(lambda x: x not in (".", "..") and os.path.isdir(x) and os.path.exists(os.path.join(os.getcwd(), x, "settings.yaml")), os.listdir(os.getcwd()))
|
dirs = filter(lambda x: x not in (".", "..") and os.path.isdir(x) and os.path.exists(os.path.join(os.getcwd(), x, "settings.yaml")), os.listdir(os.getcwd()))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user