aboutsummaryrefslogtreecommitdiff
path: root/qc_app/upload
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-09 04:22:51 +0300
committerFrederick Muriuki Muriithi2024-02-12 18:17:38 +0300
commit4c077c01db19e8adc01d9559677ad5693a1db909 (patch)
tree3aeedc2ef8b18aa5a6bddb162531487687ae11e9 /qc_app/upload
parentdd369b846524fed0c08d1b7318fd73478506c3ee (diff)
downloadgn-uploader-4c077c01db19e8adc01d9559677ad5693a1db909.tar.gz
Raise error if file is missing rather than returning a Union value.
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.")