about summary refs log tree commit diff
path: root/uploader/species/views.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-12-10 12:57:14 -0600
committerFrederick Muriuki Muriithi2025-12-10 12:57:14 -0600
commit09fc4bbc3ef66b02f0711dadaf3b10ed53d9d968 (patch)
tree722daa9cee62cc7d66ed58f85fc18dcbf2636a89 /uploader/species/views.py
parent7838bd59c7fe3fbc936c932f1729c7372eb158ed (diff)
downloadgn-uploader-09fc4bbc3ef66b02f0711dadaf3b10ed53d9d968.tar.gz
Feature Flags: Generically deal with HTTP-based feature flags.
* Define a default `FEATURE_FLAGS_HTTP` configuration variable that's
  an empty list to help defining http-based feature flags that can be
  used to turn on/off features
* Build macro to include hidden fields for feature flags where
  necessary.
* Extend flask's `url_for` function to deal with defined feature flags
  in a mostly transparent way
Diffstat (limited to 'uploader/species/views.py')
-rw-r--r--uploader/species/views.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/uploader/species/views.py b/uploader/species/views.py
index a490b0f..20acd01 100644
--- a/uploader/species/views.py
+++ b/uploader/species/views.py
@@ -4,13 +4,13 @@ from pymonad.either import Left, Right, Either
 from gn_libs.mysqldb import database_connection
 from flask import (flash,
                    request,
-                   url_for,
                    redirect,
                    Blueprint,
                    current_app as app)
 
 from uploader.population import popbp
 from uploader.platforms import platformsbp
+from uploader.flask_extensions import url_for
 from uploader.ui import make_template_renderer
 from uploader.oauth2.client import oauth2_get, oauth2_post
 from uploader.authorisation import require_login, require_token
@@ -52,21 +52,19 @@ def view_species(species_id: int):
             if bool(population):
                 return redirect(url_for("species.populations.view_population",
                                         species_id=species_id,
-                                        population_id=population["Id"],
-                                        streamlined_ui=streamlined_ui))
+                                        population_id=population["Id"]))
             return render_template(
                 ("species/sui-view-species.html"
                  if bool(streamlined_ui)
                  else "species/view-species.html"),
                 species=species,
                 activelink="view-species",
-                streamlined_ui=streamlined_ui,
                 populations=populations_by_species(conn, species["SpeciesId"]))
         flash("Could not find a species with the given identifier.",
               "alert-danger")
-        return redirect(url_for(
-            ("base.index" if streamlined_ui else "species.view_species"),
-            streamlined_ui=streamlined_ui))
+        return redirect(url_for("base.index"
+                                if streamlined_ui
+                                else "species.view_species"))
 
 @speciesbp.route("/create", methods=["GET", "POST"])
 @require_login