aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-10 15:55:55 -0500
committerFrederick Muriuki Muriithi2024-06-10 15:55:55 -0500
commitfcde5e0d388c00c4f428d01def27907cd58625de (patch)
tree3ba0ed499c5be77b8215a3da475a254f9f20060c /gn2/wqflask
parentb5da5e3ed085e07dc7367f222cc7a1beade000a6 (diff)
downloadgenenetwork2-fcde5e0d388c00c4f428d01def27907cd58625de.tar.gz
Import the UUID class directly.
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/oauth2/resources.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/gn2/wqflask/oauth2/resources.py b/gn2/wqflask/oauth2/resources.py
index 70b49375..34b11235 100644
--- a/gn2/wqflask/oauth2/resources.py
+++ b/gn2/wqflask/oauth2/resources.py
@@ -1,4 +1,4 @@
-import uuid
+from uuid import UUID
from flask import (
flash, request, url_for, redirect, Response, Blueprint)
@@ -64,7 +64,7 @@ def __compute_page__(submit, current_page):
@resources.route("/view/<uuid:resource_id>", methods=["GET"])
@require_oauth2
-def view_resource(resource_id: uuid.UUID):
+def view_resource(resource_id: UUID):
"""View the given resource."""
page = __compute_page__(request.args.get("submit"),
int(request.args.get("page", "1"), base=10))
@@ -206,7 +206,7 @@ def unlink_data_from_resource():
@resources.route("<uuid:resource_id>/user/assign", methods=["POST"])
@require_oauth2
-def assign_role(resource_id: uuid.UUID) -> Response:
+def assign_role(resource_id: UUID) -> Response:
form = request.form
group_role_id = form.get("group_role_id", "")
user_email = form.get("user_email", "")
@@ -237,7 +237,7 @@ def assign_role(resource_id: uuid.UUID) -> Response:
@resources.route("<uuid:resource_id>/user/unassign", methods=["POST"])
@require_oauth2
-def unassign_role(resource_id: uuid.UUID) -> Response:
+def unassign_role(resource_id: UUID) -> Response:
form = request.form
group_role_id = form.get("group_role_id", "")
user_id = form.get("user_id", "")
@@ -268,7 +268,7 @@ def unassign_role(resource_id: uuid.UUID) -> Response:
@resources.route("/toggle/<uuid:resource_id>", methods=["POST"])
@require_oauth2
-def toggle_public(resource_id: uuid.UUID):
+def toggle_public(resource_id: UUID):
"""Toggle the given resource's public status."""
def __handle_error__(err):
flash_error(process_error(err))
@@ -287,19 +287,19 @@ def toggle_public(resource_id: uuid.UUID):
@resources.route("/edit/<uuid:resource_id>", methods=["GET"])
@require_oauth2
-def edit_resource(resource_id: uuid.UUID):
+def edit_resource(resource_id: UUID):
"""Edit the given resource."""
return "WOULD Edit THE GIVEN RESOURCE'S DETAILS"
@resources.route("/delete/<uuid:resource_id>", methods=["GET"])
@require_oauth2
-def delete_resource(resource_id: uuid.UUID):
+def delete_resource(resource_id: UUID):
"""Delete the given resource."""
return "WOULD DELETE THE GIVEN RESOURCE"
@resources.route("/<uuid:resource_id>/role/<uuid:role_id>", methods=["GET"])
@require_oauth2
-def view_resource_role(resource_id: uuid.UUID, role_id: uuid.UUID):
+def view_resource_role(resource_id: UUID, role_id: UUID):
"""View resource role page."""
def __render_template__(**kwargs):
return render_ui("oauth2/view-resource-role.html", **kwargs)