[mod] simplify code

This commit is contained in:
Laurent Peuch 2016-02-09 21:41:57 +01:00
parent 5399f9e8e0
commit 96b364a874

View File

@ -180,10 +180,9 @@ def main():
front_page_galleries_cover = reversed(sorted(front_page_galleries_cover, key=lambda x: x["date"]))
for item in settings.get("menu", []):
for link in item:
item_file = link
error(os.path.exists(os.path.join(os.getcwd(), item_file + ".yaml")), "I can't find a " + item_file + ".yaml in the current working directory as specified by your menu description in your root settings.yaml")
open(os.path.join("build", item_file + ".html"), "w").write(page_template.render(settings=settings, pages=yaml.safe_load(open(item_file + ".yaml", "r")), galleries=front_page_galleries_cover).encode("Utf-8"))
file_name, menu_name = item.items()[0]
error(os.path.exists(os.path.join(os.getcwd(), file_name + ".yaml")), "I can't find a " + file_name + ".yaml in the current working directory as specified by your menu description in your root settings.yaml")
open(os.path.join("build", file_name + ".html"), "w").write(page_template.render(settings=settings, pages=yaml.safe_load(open(file_name + ".yaml", "r")), galleries=front_page_galleries_cover).encode("Utf-8"))
Image.base_dir = os.getcwd()
Image.target_dir = os.path.join(os.getcwd(), "build")