[mod] move to a more django oriented style of settings
This commit is contained in:
parent
24b9883f02
commit
b4ddd0a0b6
@ -15,10 +15,12 @@ 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")
|
||||||
|
|
||||||
gm_settings = {
|
SETTINGS = {
|
||||||
|
"gm": {
|
||||||
"quality": 75,
|
"quality": 75,
|
||||||
"auto-orient": True
|
"auto-orient": True
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Image(object):
|
class Image(object):
|
||||||
base_dir = ""
|
base_dir = ""
|
||||||
@ -29,7 +31,7 @@ class Image(object):
|
|||||||
if not isinstance(options, dict):
|
if not isinstance(options, dict):
|
||||||
options = {"name": options}
|
options = {"name": options}
|
||||||
self.options = options.copy() # used for caching, if it's modified -> regenerate
|
self.options = options.copy() # used for caching, if it's modified -> regenerate
|
||||||
self.options.update(gm_settings)
|
self.options.update(SETTINGS["gm"])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
@ -96,8 +98,8 @@ def main():
|
|||||||
error(isinstance(settings, dict), "Your settings.yaml should be a dict")
|
error(isinstance(settings, dict), "Your settings.yaml should be a dict")
|
||||||
error(settings.get("title"), "You should specify a title in your main settings.yaml")
|
error(settings.get("title"), "You should specify a title in your main settings.yaml")
|
||||||
|
|
||||||
if settings.get("gm_settings"):
|
if settings.get("settings", {}).get("gm"):
|
||||||
gm_settings.update(settings.get("gm_settings"))
|
SETTINGS["gm"].update(settings["settings"]["gm"])
|
||||||
|
|
||||||
front_page_galleries_cover = []
|
front_page_galleries_cover = []
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user