aboutsummaryrefslogtreecommitdiff
path: root/app/admin
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-08-27 14:32:42 +0100
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-08-27 14:32:42 +0100
commit899571eaa46e674eaaf1b46ab490e15e43efa097 (patch)
treeff985b224bbb54025414ad25e7d625d836efece1 /app/admin
parentDB migration for full name column in User table (diff)
downloadAnnotateChange-899571eaa46e674eaaf1b46ab490e15e43efa097.tar.gz
AnnotateChange-899571eaa46e674eaaf1b46ab490e15e43efa097.zip
Be more graceful if the original file doesn't exist
This is mainly used for testing and shouldn't happen in production.
Diffstat (limited to 'app/admin')
-rw-r--r--app/admin/routes.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/admin/routes.py b/app/admin/routes.py
index 9b7688b..e07475f 100644
--- a/app/admin/routes.py
+++ b/app/admin/routes.py
@@ -146,7 +146,6 @@ def manage_datasets():
filename = os.path.join(dataset_dir, dataset.name + ".json")
if not os.path.exists(filename):
flash("Internal error: dataset file doesn't exist!", "error")
- return redirect(url_for("admin.manage_datasets"))
tasks = Task.query.filter_by(dataset_id=dataset.id).all()
for task in tasks:
@@ -155,7 +154,8 @@ def manage_datasets():
db.session.delete(task)
db.session.delete(dataset)
db.session.commit()
- os.unlink(filename)
+ if os.path.exists(filename):
+ os.unlink(filename)
flash("Dataset deleted successfully.", "success")
return redirect(url_for("admin.manage_datasets"))