diff options
author | BonfaceKilz | 2021-10-28 15:40:01 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-11-04 15:22:41 +0300 |
commit | 6d496d5734f48ed8477ad0666af77c377a9185df (patch) | |
tree | c5ad819bd7ca2d9e6a4cce147b12dcda5f202237 /wqflask | |
parent | 8ec8a9c4a62dfaf9c674926349f2e09b083711a4 (diff) | |
download | genenetwork2-6d496d5734f48ed8477ad0666af77c377a9185df.tar.gz |
metadata_edits.py: Embed resource-id in a given file-name csv
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/metadata_edits.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index 85f45592..c28f5681 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -170,12 +170,10 @@ def update_phenotype(dataset_id: str, name: str): author = ((g.user_session.record.get(b"user_id") or b"").decode("utf-8") or g.user_session.record.get("user_id") or "") phenotype_id = str(data_.get('phenotype-id')) - if 'file' not in request.files: + if not (file_ := request.files.get("file")): flash("No sample-data has been uploaded", "warning") else: - file_ = request.files['file'] - SAMPLE_DATADIR = os.path.join(TMPDIR, "sample-data") - if not os.path.exists(SAMPLE_DATADIR): + if not os.path.exists(SAMPLE_DATADIR := os.path.join(TMPDIR, "sample-data")): os.makedirs(SAMPLE_DATADIR) if not os.path.exists(os.path.join(SAMPLE_DATADIR, "diffs")): @@ -189,7 +187,7 @@ def update_phenotype(dataset_id: str, name: str): new_file_name = (os.path.join(TMPDIR, "sample-data/updated/", (f"{author}." - f"{name}.{phenotype_id}." + f"{request.args.get('resource-id')}." f"{current_time}.csv"))) uploaded_file_name = (os.path.join( TMPDIR, |