Skip to content

Commit 7802f56

Browse files
committed
fix(core): in get_code, remap events.hitpoint2017 to zombies.hitpoint2017 to fix 500 in /profile/programmes
1 parent 0c113af commit 7802f56

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

backend/core/utils/misc_utils.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
def give_all_app_perms_to_group(app_label, group):
1313
for ctype in ContentType.objects.filter(app_label=app_label):
14-
for perm in ctype.permission_set.all():
14+
for perm in ctype.permission_set.all(): # type: ignore
1515
perm.group_set.add(group) # type: ignore
1616

1717

@@ -55,14 +55,21 @@ def ensure_groups_exist(group_names):
5555
return [Group.objects.get_or_create(name=group_name)[0] for group_name in group_names]
5656

5757

58-
def get_code(path):
58+
REMAP_MODULES = {
59+
"events.hitpoint2017": "zombies.hitpoint2017",
60+
}
61+
62+
63+
def get_code(path: str):
5964
"""
60-
Given "core.utils:get_code", imports the module "core.utils" and returns
65+
Given "core.utils.misc_utils:get_code", imports the module "core.utils.misc_utils" and returns
6166
"get_code" from it.
6267
"""
6368
from importlib import import_module
6469

6570
module_name, member_name = path.split(":")
71+
module_name = REMAP_MODULES.get(module_name, module_name)
72+
6673
module = import_module(module_name)
6774
return getattr(module, member_name)
6875

0 commit comments

Comments
 (0)