aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2021-08-04 14:51:20 +0300
committerBonfaceKilz2021-08-04 14:51:20 +0300
commita24ea03594d6879adf92cd4db2b52108ddb352bd (patch)
tree49d131fea02dff9338695c141f314b3ae36c7a01 /wqflask
parent759b04823818cd09f5e8e78299f270b3f7b73042 (diff)
downloadgenenetwork2-a24ea03594d6879adf92cd4db2b52108ddb352bd.tar.gz
wqflask: views: Replace hard-coded "/tmp" dir
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index a40e0d44..fe81bb6c 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -592,7 +592,7 @@ def update_phenotype():
r = run_cmd(cmd=("csvdiff "
f"'{uploaded_file_name}' '{new_file_name}' "
"--format json"))
- diff_output = ("/tmp/sample-data/diffs/"
+ diff_output = (f"{TMPDIR}/sample-data/diffs/"
f"{trait_name}.{author.decode('utf-8')}."
f"{phenotype_id}.{current_time}.json")
with open(diff_output, "w") as f:
@@ -1398,7 +1398,8 @@ def get_sample_data_as_csv(trait_name: int, phenotype_id: int):
@app.route("/admin/data-sample/diffs/")
@admin_login_required
def display_diffs_admin():
- DIFF_DIR = "/tmp/sample-data/diffs"
+ TMPDIR = current_app.config.get("TMPDIR")
+ DIFF_DIR = f"{TMPDIR}/sample-data/diffs"
files = []
if os.path.exists(DIFF_DIR):
files = os.listdir(DIFF_DIR)
@@ -1410,7 +1411,8 @@ def display_diffs_admin():
@app.route("/user/data-sample/diffs/")
def display_diffs_users():
- DIFF_DIR = "/tmp/sample-data/diffs"
+ TMPDIR = current_app.config.get("TMPDIR")
+ DIFF_DIR = f"{TMPDIR}/sample-data/diffs"
files = []
author = g.user_session.record.get(b'user_name').decode("utf-8")
if os.path.exists(DIFF_DIR):