Browse Source

refactor: no need to try if the type check is performed

pull/355/head
Richard Nemeth 2 years ago
parent
commit
3052f80fd6
  1. 16
      src/keycloak/uma_permissions.py

16
src/keycloak/uma_permissions.py

@ -206,13 +206,9 @@ def build_permission_param(permissions):
except AttributeError:
pass
try: # treat as any other iterable of permissions
result = set()
for permission in permissions:
if not isinstance(permission, (str, UMAPermission)):
raise KeycloakPermissionFormatError("misbuilt permission {}".format(permissions))
result.add(str(permission))
return result
except TypeError:
pass
raise KeycloakPermissionFormatError("misbuilt permission {}".format(permissions))
result = set()
for permission in permissions:
if not isinstance(permission, (str, UMAPermission)):
raise KeycloakPermissionFormatError("misbuilt permission {}".format(permissions))
result.add(str(permission))
return result
Loading…
Cancel
Save