create const.py

This commit is contained in:
atrc445 2021-08-21 13:06:28 +02:00
parent ed34250b31
commit cac0ebfead
18 changed files with 155 additions and 91 deletions

View file

@ -1,5 +1,6 @@
from files.__main__ import app
from .get import *
from files.helpers import const
@app.template_filter("full_link")
@ -19,4 +20,10 @@ def post_embed(id, v):
p = get_post(id, graceful=True)
return render_template("submission_listing.html", listing=[p], v=v)
return render_template("submission_listing.html", listing=[p], v=v)
@app.context_processor
def inject_constants():
constants = [c for c in dir(const) if not c.startswith("_")]
return {c:getattr(const, c) for c in constants}