aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-08-02 21:45:17 +0300
committerBonfaceKilz2021-08-03 15:49:50 +0300
commit4594743baf6e6fd4b50f68665d009084f605bc78 (patch)
treeefb0d9fadd926ec4b77d0dfccb556d10fe5ea8da
parente200245b2a1666b7a16f4484891c7c2b143fefe9 (diff)
downloadgenenetwork2-4594743baf6e6fd4b50f68665d009084f605bc78.tar.gz
wqflask: views: After approval, rename the file at the right point
-rw-r--r--wqflask/wqflask/views.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 1a8536ac..c7582782 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1434,10 +1434,11 @@ def approve_data(name):
dataset_id=name.split(".")[0], # use the dataset name
editor=sample_data.get("author"),
json_data=json.dumps(sample_data)))
- # Once data is approved, rename it!
- os.rename(os.path.join("/tmp/sample-data/diffs", name),
- os.path.join("/tmp/sample-data/diffs",
- f"{name}.approved"))
+ if modifications:
+ # Once data is approved, rename it!
+ os.rename(os.path.join("/tmp/sample-data/diffs", name),
+ os.path.join("/tmp/sample-data/diffs",
+ f"{name}.approved"))
return redirect("/admin/data-sample/diffs/")