summaryrefslogtreecommitdiff
path: root/jimbrella
diff options
context:
space:
mode:
Diffstat (limited to 'jimbrella')
-rw-r--r--jimbrella/admin.py2
-rw-r--r--jimbrella/config.py17
-rw-r--r--jimbrella/lockfile.py4
3 files changed, 13 insertions, 10 deletions
diff --git a/jimbrella/admin.py b/jimbrella/admin.py
index eaf0e54..49cbf55 100644
--- a/jimbrella/admin.py
+++ b/jimbrella/admin.py
@@ -17,7 +17,7 @@ def check_privilege():
# only clients who have obtained a session and sent it in the Cookie header
# will have a decryptable username here
if "username" not in session:
- return redirect(url_for("auth.login"))
+ return redirect(url_for("auth.auth", action="login"))
username = session["username"]
user = users.find(username) # under normal circumstances it must exist
diff --git a/jimbrella/config.py b/jimbrella/config.py
index dd4aa00..48265e9 100644
--- a/jimbrella/config.py
+++ b/jimbrella/config.py
@@ -1,4 +1,5 @@
import os
+from pathlib import Path
import toml
config_path = (
@@ -11,18 +12,20 @@ f = open(config_path)
config = toml.load(f)
f.close()
+JIMBRELLA_DIR = Path(config["jimbrella_dir"])
+
FLASK_SECRET_KEY = config["flask"]["secret_key"]
ACCEPT_NEW_USERS = config["user"]["accept_new_users"]
-JFORM_TAKEAWAY_URL = config["jform"]["takeaway_url"]
-JFORM_GIVEBACK_URL = config["jform"]["giveback_url"]
-JFORM_BOOKMARK_DIR = config["jform"]["bookmark_dir"]
+JFORM_TAKEAWAY_URL = JIMBRELLA_DIR / Path(config["jform"]["takeaway_url"])
+JFORM_GIVEBACK_URL = JIMBRELLA_DIR / Path(config["jform"]["giveback_url"])
+JFORM_BOOKMARK_DIR = JIMBRELLA_DIR / Path(config["jform"]["bookmark_dir"])
-DATABASE_PATH = config["db"]["db_path"]
-USERS_PATH = config["db"]["users_path"]
+DATABASE_PATH = JIMBRELLA_DIR / Path(config["db"]["db_path"])
+USERS_PATH = JIMBRELLA_DIR / Path(config["db"]["users_path"])
DUE_HOURS = config["rules"]["due_hours"]
-LOG_PATH = config["logging"]["log_path"]
-ADMIN_LOG_PATH = config["logging"]["admin_log_path"]
+LOG_PATH = JIMBRELLA_DIR / Path(config["logging"]["log_path"])
+ADMIN_LOG_PATH = JIMBRELLA_DIR / Path(config["logging"]["admin_log_path"])
diff --git a/jimbrella/lockfile.py b/jimbrella/lockfile.py
index b898142..987f0e3 100644
--- a/jimbrella/lockfile.py
+++ b/jimbrella/lockfile.py
@@ -11,8 +11,8 @@ class Lockfile:
"""
def __init__(self, filepath):
- self.filepath = filepath
- self.lockpath = filepath + ".lock"
+ self.filepath = str(filepath)
+ self.lockpath = self.filepath + ".lock"
def lock(self):
"""Continue attempting to lock until locked."""