]> WPIA git - motion.git/blobdiff - motion.py
add: add footer with copyright and legal requirements
[motion.git] / motion.py
index e2f3f15ab28854e27e927f7260615ed3e696b0d7..80ac5a36029eb728e0bf7031fb0404caf0397c8e 100644 (file)
--- a/motion.py
+++ b/motion.py
@@ -26,7 +26,16 @@ class EscapeHtml(Extension):
 
 md = Markdown(app, extensions=[EscapeHtml()])
 
+class default_settings(object):
+    COPYRIGHTSTART="2017"
+    COPYRIGHTNAME="WPIA"
+    COPYRIGHTLINK="https://wpia.club"
+    IMPRINTLINK="https://documents.wpia.club/imprint.html"
+    DATAPROTECTIONLINK="https://documents.wpia.club/data_privacy_policy_html_pages_en.html"
+
+
 # Load config
+app.config.from_object('motion.default_settings')
 app.config.from_pyfile('config.py')
 
 
@@ -94,6 +103,23 @@ def lookup_user():
                 g.roles[a[0]].append(val)
     return None
 
+@app.context_processor
+def init_footer_variables():
+    if int(app.config.get("COPYRIGHTSTART"))<datetime.now().year:
+        version_year = "%s - %s" % (app.config.get("COPYRIGHTSTART"), datetime.now().year)
+    else:
+        version_year = datetime.now().year
+
+    return dict(
+        footer = dict( version_year=version_year, 
+            copyright_link=app.config.get("COPYRIGHTLINK"),
+            copyright_name=app.config.get("COPYRIGHTNAME"),
+            imprint_link=app.config.get("DATAPROTECTIONLINK"),
+            dataprotection_link=app.config.get("DATAPROTECTIONLINK")
+        )
+    )
+
+
 def get_allowed_cats(action):
     return g.roles.get(action, []);
 
@@ -149,7 +175,6 @@ def init_db():
                 db.prepare("ALTER TABLE \"motion\" ALTER COLUMN \"host\" SET NOT NULL")()
                 db.prepare("UPDATE \"schema_version\" SET \"version\"=3")()
 
-
 init_db()
 
 @app.route("/")