update prosopopee.py after revert

This commit is contained in:
Adrien Beudin 2016-02-22 19:02:49 +01:00
parent ce97f7c18a
commit d6ca3b41c0

View File

@ -10,11 +10,6 @@ from jinja2 import Environment, FileSystemLoader
from .cache import CACHE from .cache import CACHE
from .utils import error from .utils import error
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
index_template = templates.get_template("index.html")
gallery_index_template = templates.get_template("gallery-index.html")
page_template = templates.get_template("page.html")
SETTINGS = { SETTINGS = {
"show_date": True, "show_date": True,
"gm": { "gm": {
@ -118,19 +113,21 @@ def main():
# XXX recursively merge directories # XXX recursively merge directories
if os.path.exists(os.path.join(os.getcwd(), "build", "static")): if os.path.exists(os.path.join(os.getcwd(), "build", "static")):
shutil.rmtree(os.path.join(os.getcwd(), "build", "static")) shutil.rmtree(os.path.join(os.getcwd(), "build", "static"))
if settings.get("theme"):
if os.path.exists(os.path.join(os.getcwd(), "templates")): if settings.get("theme") is None:
shutil.rmtree(os.path.join(os.getcwd(), "templates")) gallery_theme = "exposure"
shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", settings.get("theme"), "static"), os.path.join(os.getcwd(), "build", "static")) else:
shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", settings.get("theme"), "templates"), os.path.join(os.getcwd(), "templates")) gallery_theme = settings.get("theme")
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
if os.path.exists(os.path.join(os.getcwd(), "static")):
shutil.copytree(os.path.join(os.getcwd(), "static"), os.path.join(os.getcwd(), "build", "static"))
else:
shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", gallery_theme, "static"), os.path.join(os.getcwd(), "build", "static"))
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", gallery_theme, "templates")]))
index_template = templates.get_template("index.html") index_template = templates.get_template("index.html")
gallery_index_template = templates.get_template("gallery-index.html") gallery_index_template = templates.get_template("gallery-index.html")
page_template = templates.get_template("page.html") page_template = templates.get_template("page.html")
elif os.path.exists(os.path.join(os.getcwd(), "static")):
shutil.copytree(os.path.join(os.getcwd(), "static"), os.path.join(os.getcwd(), "build", "static"))
else:
shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "static"), os.path.join(os.getcwd(), "build", "static"))
for gallery in dirs: for gallery in dirs:
gallery_settings = yaml.safe_load(open(os.path.join(os.getcwd(), gallery, "settings.yaml"), "r")) gallery_settings = yaml.safe_load(open(os.path.join(os.getcwd(), gallery, "settings.yaml"), "r"))