diff options
| author | Frederick Muriuki Muriithi | 2025-12-10 12:57:14 -0600 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2025-12-10 12:57:14 -0600 |
| commit | 09fc4bbc3ef66b02f0711dadaf3b10ed53d9d968 (patch) | |
| tree | 722daa9cee62cc7d66ed58f85fc18dcbf2636a89 /uploader/__init__.py | |
| parent | 7838bd59c7fe3fbc936c932f1729c7372eb158ed (diff) | |
| download | gn-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/__init__.py')
| -rw-r--r-- | uploader/__init__.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/uploader/__init__.py b/uploader/__init__.py index b7f0ab9..7425b38 100644 --- a/uploader/__init__.py +++ b/uploader/__init__.py @@ -22,6 +22,7 @@ from .files.views import files from .species import speciesbp from .publications import pubbp from .oauth2.views import oauth2 +from .flask_extensions import url_for from .expression_data import exprdatabp from .errors import register_error_handlers from .background_jobs import background_jobs_bp @@ -109,17 +110,22 @@ def create_app(config: Optional[dict] = None): setup_logging(app) setup_modules_logging(app.logger, ( "uploader.base_routes", + "uploader.flask_extensions", "uploader.publications.models", "uploader.publications.datatables", "uploader.phenotypes.models")) # setup jinja2 symbols - app.add_template_global(lambda : request.url, name="request_url") + app.add_template_global(user_logged_in) + app.add_template_global(url_for, name="url_for") app.add_template_global(authserver_authorise_uri) + app.add_template_global(lambda : request.url, name="request_url") app.add_template_global(lambda: app.config["GN2_SERVER_URL"], name="gn2server_uri") - app.add_template_global(user_logged_in) - app.add_template_global(lambda : session.user_details()["email"], name="user_email") + app.add_template_global(lambda : session.user_details()["email"], + name="user_email") + app.add_template_global(lambda: app.config["FEATURE_FLAGS_HTTP"], + name="http_feature_flags") Session(app) |
