From ea378934f1aeac6e8540a93f1b7c967a8921c4ef Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 2 Sep 2022 19:06:13 +0100 Subject: [PATCH] Rename function --- person.py | 4 ++-- roles.py | 8 ++++---- tests.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/person.py b/person.py index 733ff24b6..7285d9c6e 100644 --- a/person.py +++ b/person.py @@ -35,7 +35,7 @@ from posts import create_moderation from auth import store_basic_credentials from auth import remove_password from roles import set_role -from roles import set_rolesFromList +from roles import actor_roles_from_list from roles import get_actor_roles_list from media import process_meta_data from utils import safe_system_string @@ -860,7 +860,7 @@ def person_upgrade_actor(base_dir: str, person_json: {}, admin_name = get_config_param(base_dir, 'admin') if person_json['id'].endswith('/users/' + admin_name): roles_list = ["admin", "moderator", "editor"] - set_rolesFromList(person_json, roles_list) + actor_roles_from_list(person_json, roles_list) update_actor = True # remove the old roles format diff --git a/roles.py b/roles.py index b5b331347..0a1207b59 100644 --- a/roles.py +++ b/roles.py @@ -38,7 +38,7 @@ def _clear_role_status(base_dir: str, role: str) -> None: roles_list = get_actor_roles_list(actor_json) if role in roles_list: roles_list.remove(role) - set_rolesFromList(actor_json, roles_list) + actor_roles_from_list(actor_json, roles_list) save_json(actor_json, filename) @@ -172,7 +172,7 @@ def _set_actor_role(actor_json: {}, role_name: str) -> bool: return True -def set_rolesFromList(actor_json: {}, roles_list: []) -> None: +def actor_roles_from_list(actor_json: {}, roles_list: []) -> None: """Sets roles from a list """ # clear Roles from the occupation list @@ -245,7 +245,7 @@ def set_role(base_dir: str, nickname: str, domain: str, if role not in roles_list: roles_list.append(role) roles_list.sort() - set_rolesFromList(actor_json, roles_list) + actor_roles_from_list(actor_json, roles_list) actor_changed = True else: # remove the role @@ -253,7 +253,7 @@ def set_role(base_dir: str, nickname: str, domain: str, _remove_role(base_dir, nickname, role_files[role]) if role in roles_list: roles_list.remove(role) - set_rolesFromList(actor_json, roles_list) + actor_roles_from_list(actor_json, roles_list) actor_changed = True if actor_changed: save_json(actor_json, actor_filename) diff --git a/tests.py b/tests.py index 3dcb75603..8b9ba7068 100644 --- a/tests.py +++ b/tests.py @@ -107,7 +107,7 @@ from skills import set_skill_level from skills import actor_skill_value from skills import set_skills_from_dict from skills import actor_has_skill -from roles import set_rolesFromList +from roles import actor_roles_from_list from roles import set_role from roles import actor_has_role from auth import constant_time_string_check @@ -6420,7 +6420,7 @@ def _test_roles() -> None: ] } test_roles_list = ["admin", "moderator"] - set_rolesFromList(actor_json, test_roles_list) + actor_roles_from_list(actor_json, test_roles_list) assert actor_has_role(actor_json, "admin") assert actor_has_role(actor_json, "moderator") assert not actor_has_role(actor_json, "editor")