1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #11927: Correct loading of plugin resources with custom paths

This commit is contained in:
jeremystretch
2023-03-13 08:52:38 -04:00
parent 065738473e
commit 267a14264b
2 changed files with 3 additions and 2 deletions

View File

@@ -78,8 +78,8 @@ class PluginConfig(AppConfig):
def _load_resource(self, name):
# Import from the configured path, if defined.
if getattr(self, name):
return import_string(f"{self.__module__}.{self.name}")
if path := getattr(self, name, None):
return import_string(f"{self.__module__}.{path}")
# Fall back to the resource's default path. Return None if the module has not been provided.
default_path = f'{self.__module__}.{DEFAULT_RESOURCE_PATHS[name]}'