From 29e24855d0b223edfbf20bbe5799db7a9e0ad21e Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 17 Jan 2024 05:01:27 +0300 Subject: Update flash-messages' categories. --- qc_app/upload/rqtl2.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index f9185b1..146c301 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -41,7 +41,7 @@ def select_species(): if bool(species): return redirect(url_for( "upload.rqtl2.select_population", species_id=species_id)) - flash("Invalid species or no species selected!", "alert-error error-rqtl2") + flash("Invalid species or no species selected!", "alert-error alert-rqtl2") return redirect(url_for("upload.rqtl2.select_species")) @rqtl2.route("/upload/species//select-population", @@ -51,7 +51,7 @@ def select_population(species_id: int): with database_connection(app.config["SQL_URI"]) as conn: species = species_by_id(conn, species_id) if not bool(species): - flash("Invalid species selected!", "alert-error error-rqtl2") + flash("Invalid species selected!", "alert-error alert-rqtl2") return redirect(url_for("upload.rqtl2.select_species")) if request.method == "GET": @@ -63,7 +63,7 @@ def select_population(species_id: int): population = population_by_species_and_id( conn, species["SpeciesId"], request.form.get("inbredset_id")) if not bool(population): - flash("Invalid Population!", "alert-error error-rqtl2") + flash("Invalid Population!", "alert-error alert-rqtl2") return redirect( url_for("upload.rqtl2.select_population", pgsrc="error"), code=307) @@ -82,13 +82,13 @@ def create_population(species_id: int): population_name = request.form.get("inbredset_name", "").strip() population_fullname = request.form.get("inbredset_fullname", "").strip() if not bool(species): - flash("Invalid species!", "alert-error error-rqtl2") + flash("Invalid species!", "alert-error alert-rqtl2") return redirect(url_for("upload.rqtl2.select_species")) if not bool(population_name): - flash("Invalid Population Name!", "alert-error error-rqtl2") + flash("Invalid Population Name!", "alert-error alert-rqtl2") return population_page if not bool(population_fullname): - flash("Invalid Population Full Name!", "alert-error error-rqtl2") + flash("Invalid Population Full Name!", "alert-error alert-rqtl2") return population_page new_population = save_population(conn, { "SpeciesId": species["SpeciesId"], @@ -125,10 +125,10 @@ def upload_rqtl2_bundle(species_id: int, population_id: int): population = population_by_species_and_id( conn, species["SpeciesId"], population_id) if not bool(species): - flash("Invalid species!", "alert-error error-rqtl2") + flash("Invalid species!", "alert-error alert-rqtl2") return redirect(url_for("upload.rqtl2.select_species")) if not bool(population): - flash("Invalid Population!", "alert-error error-rqtl2") + flash("Invalid Population!", "alert-error alert-rqtl2") return redirect( url_for("upload.rqtl2.select_population", pgsrc="error"), code=307) @@ -159,7 +159,7 @@ def upload_rqtl2_bundle(species_id: int, population_id: int): population=population, rqtl2_bundle_file=the_file.name) except (InvalidFormat, __RequestError__) as exc: - flash("".join(exc.args), "alert-error alert-danger error-rqtl2") + flash("".join(exc.args), "alert-error alert-rqtl2") return this_page_with_errors def check_errors(conn, *args, **kwargs) -> Optional[Response]: @@ -171,19 +171,18 @@ def check_errors(conn, *args, **kwargs) -> Optional[Response]: population = population_by_species_and_id(conn, species_id, population_id) if "species" in args and not bool(species): - flash("Invalid species!", "alert-error error-rqtl2") + flash("Invalid species!", "alert-error alert-rqtl2") return redirect(url_for("upload.rqtl2.select_species")) if "population" in args and not bool(population): - flash("Invalid Population!", "alert-error error-rqtl2") + flash("Invalid Population!", "alert-error alert-rqtl2") return redirect( url_for("upload.rqtl2.select_population", pgsrc="error"), code=307) if ("rqtl2_bundle_file" in args and not bool(request.form.get("rqtl2_bundle_file"))): - flash("There is no file to process.", - "alert-error alert-danger error-rqtl2") + flash("There is no file to process.", "alert-error alert-rqtl2") return redirect(url_for("upload.rqtl2.upload_rqtl2_bundle", species_id=species_id, population_id=population_id, -- cgit v1.2.3