From a93b9599d6e342f8fd588022ca14336465f7ff7c Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 10 Feb 2023 14:07:41 +0300 Subject: Return empty tuple rather than Nothing When user has no roles assigned, return an empty tuple rather than pymonad.maybe.Nothing to ease maintenance. --- gn3/auth/authorisation/users/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gn3/auth/authorisation/users') diff --git a/gn3/auth/authorisation/users/views.py b/gn3/auth/authorisation/users/views.py index 8a29fea..c592a3f 100644 --- a/gn3/auth/authorisation/users/views.py +++ b/gn3/auth/authorisation/users/views.py @@ -46,9 +46,7 @@ def user_roles() -> Response: with require_oauth.acquire("role") as token: with db.connection(current_app.config["AUTH_DB"]) as conn: return jsonify(tuple( - dictify(role) for role in - _user_roles(conn, token.user).maybe(# type: ignore[misc] - tuple(), lambda roles: roles))) + dictify(role) for role in _user_roles(conn, token.user))) def __email_valid__(email: str) -> Tuple[bool, Optional[str]]: """Validate the email address.""" -- cgit v1.2.3