Skip to content

Commit

Permalink
updates ordering of callsites for arches applications #11009
Browse files Browse the repository at this point in the history
  • Loading branch information
chrabyrd committed Jul 15, 2024
1 parent 9195462 commit aa579ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
20 changes: 9 additions & 11 deletions arches/app/utils/module_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,24 @@ def get_module(path, modulename=""):


def get_directories(extension_type: ExtensionType):
core_root_dir = f"arches.app.{extension_type.value}"
if extension_type is ExtensionType.SEARCH_COMPONENTS:
core_root_dir = core_root_dir.replace("search_components", "search.components")

core_and_arches_app_dirs = [core_root_dir]
arches_app_dirs = []
for arches_app in list_arches_app_names():
core_and_arches_app_dirs.append(f"{arches_app}.{extension_type.value}")
core_and_arches_app_dirs.append(
f"{arches_app}.pkg.extensions.{extension_type.value}"
)
arches_app_dirs.append(f"{arches_app}.{extension_type.value}")
arches_app_dirs.append(f"{arches_app}.pkg.extensions.{extension_type.value}")

filtered_settings_dirs = [
setting_dir
for setting_dir in getattr(
settings, extension_type.value.upper()[:-1] + "_LOCATIONS"
)
if setting_dir not in core_and_arches_app_dirs
if setting_dir not in arches_app_dirs
]

return core_and_arches_app_dirs + filtered_settings_dirs
core_root_dir = f"arches.app.{extension_type.value}"
if extension_type is ExtensionType.SEARCH_COMPONENTS:
core_root_dir = core_root_dir.replace("search_components", "search.components")

return arches_app_dirs + filtered_settings_dirs + [core_root_dir]


def get_class_from_modulename(modulename, classname, extension_type: ExtensionType):
Expand Down
4 changes: 2 additions & 2 deletions arches/app/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def get(self, request):
language_file_path = []

language_file_path.append(
os.path.join(settings.APP_ROOT, "locale", user_language + ".json")
os.path.join(settings.ROOT_DIR, "locale", user_language + ".json")
)

for arches_app_path in list_arches_app_paths():
Expand All @@ -129,7 +129,7 @@ def get(self, request):
)

language_file_path.append(
os.path.join(settings.ROOT_DIR, "locale", user_language + ".json")
os.path.join(settings.APP_ROOT, "locale", user_language + ".json")
)

localized_strings = {}
Expand Down

0 comments on commit aa579ac

Please sign in to comment.