aboutsummaryrefslogtreecommitdiff
path: root/gn2
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-10 15:55:55 -0500
committerAlexander_Kabui2024-08-28 15:02:45 +0300
commita22e30491d04aed31416b3e2edc40c9e2b0d348c (patch)
tree9450dd3c3380729b9e3d05726c383eb962d3306e /gn2
parent8d25673a2256e1fb0a45d62e582865bcfd84ec35 (diff)
downloadgenenetwork2-a22e30491d04aed31416b3e2edc40c9e2b0d348c.tar.gz
Import the UUID class directly.
Diffstat (limited to 'gn2')
-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)