From 6b8d8a57c92f497f4cb4930b5912e0c7977afd45 Mon Sep 17 00:00:00 2001 From: Titoko Date: Thu, 19 May 2016 19:19:09 +0200 Subject: [PATCH] Use init function for settings --- prosopopee/prosopopee.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index 08f3fdb..55de905 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -185,11 +185,10 @@ class Image(object): def __repr__(self): return self.name - -def main(): +def init(): error(os.path.exists(os.path.join(os.getcwd(), "settings.yaml")), "I can't find a " "settings.yaml in the current working directory") - + settings = yaml.safe_load(open("settings.yaml", "r")) error(isinstance(settings, dict), "Your settings.yaml should be a dict") @@ -229,6 +228,10 @@ def main(): if settings["settings"].get("gm"): SETTINGS["gm"].update(settings["settings"]["gm"]) + return settings + +def main(): + settings = init() front_page_galleries_cover = []