aboutsummaryrefslogtreecommitdiff
path: root/gn3/auth/authorisation/groups
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-04-15 19:35:53 +0300
committerFrederick Muriuki Muriithi2023-04-15 19:35:53 +0300
commitdbf0f9f0d34c9969aa6ae76f556745a9eb122106 (patch)
treec0a992202155e354dfac8a829e5dea197ceeef25 /gn3/auth/authorisation/groups
parent2b7ecb52fa5f568d7d48fc324bae8231343543bd (diff)
downloadgenenetwork3-dbf0f9f0d34c9969aa6ae76f556745a9eb122106.tar.gz
Decouple `gn3.db_utils` from `flask.current_app`.
Decouple the `gn3.db_utils` module from the global `flask.current_app` object, ensuring that the database uri value is passed in as a required argument to the `gn3.db_utils.database_connection` function.
Diffstat (limited to 'gn3/auth/authorisation/groups')
-rw-r--r--gn3/auth/authorisation/groups/views.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gn3/auth/authorisation/groups/views.py b/gn3/auth/authorisation/groups/views.py
index d7a46c0..e933bcd 100644
--- a/gn3/auth/authorisation/groups/views.py
+++ b/gn3/auth/authorisation/groups/views.py
@@ -207,7 +207,7 @@ def ungrouped_data(dataset_type: str) -> Response:
raise AuthorisationError(f"Invalid dataset type {dataset_type}")
with require_oauth.acquire("profile group resource") as _the_token:
- with gn3dbutils.database_connection() as gn3conn:
+ with gn3dbutils.database_connection(current_app.config["SQL_URI"]) as gn3conn:
return jsonify(with_db_connection(partial(
retrieve_ungrouped_data, gn3conn=gn3conn,
dataset_type=dataset_type,
@@ -226,7 +226,7 @@ def link_data() -> Response:
raise InvalidData("Unexpected dataset type requested!")
def __link__(conn: db.DbConnection):
group = group_by_id(conn, group_id)
- with gn3dbutils.database_connection() as gn3conn:
+ with gn3dbutils.database_connection(current_app.config["SQL_URI"]) as gn3conn:
return link_data_to_group(
conn, gn3conn, dataset_type, dataset_ids, group)