about summary refs log tree commit diff
path: root/qc_app/upload
diff options
context:
space:
mode:
Diffstat (limited to 'qc_app/upload')
-rw-r--r--qc_app/upload/rqtl2.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py
index afe0c2e..b96d9f0 100644
--- a/qc_app/upload/rqtl2.py
+++ b/qc_app/upload/rqtl2.py
@@ -152,13 +152,15 @@ def upload_rqtl2_bundle(species_id: int, population_id: int):
                                    species=species,
                                    population=population)
 
-        if not bool(request.files.get("rqtl2_bundle_file")):
-            raise __RequestError__("No R/qtl2 zip bundle provided.")
-
-        the_file = save_file(request.files["rqtl2_bundle_file"],
-                             Path(app.config["UPLOAD_FOLDER"]))
-        if not bool(the_file):
-            raise __RequestError__("Please provide a valid R/qtl2 zip bundle.")
+        try:
+            the_file = save_file(request.files["rqtl2_bundle_file"],
+                                 Path(app.config["UPLOAD_FOLDER"]))
+        except AssertionError:
+            flash("Please provide a valid R/qtl2 zip bundle.",
+                  "alert-error error-rqtl2")
+            return redirect(url_for("upload.rqtl2.upload_rqtl2_bundle",
+                                    species_id=species_id,
+                                    population_id=population_id))
 
         if not is_zipfile(str(the_file)):
             raise __RequestError__("Invalid file! Expected a zip file.")