This commit is contained in:
Matthias 2021-11-14 22:16:45 +01:00
parent fd5939d233
commit f13507e23c
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -179,12 +179,7 @@ class PluginAppConfig(AppConfig):
# add them to the INSTALLED_APPS # add them to the INSTALLED_APPS
for slug, plugin in plugins: for slug, plugin in plugins:
if plugin.mixin_enabled('app'): if plugin.mixin_enabled('app'):
try: plugin_path = self._get_plugin_path(plugin)
# for local path plugins
plugin_path = '.'.join(pathlib.Path(plugin.path).relative_to(settings.BASE_DIR).parts)
except ValueError:
# plugin is shipped as package
plugin_path = plugin.PLUGIN_NAME
if plugin_path not in settings.INSTALLED_APPS: if plugin_path not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS += [plugin_path] settings.INSTALLED_APPS += [plugin_path]
settings.INTEGRATION_APPS_PATHS += [plugin_path] settings.INTEGRATION_APPS_PATHS += [plugin_path]
@ -196,6 +191,15 @@ class PluginAppConfig(AppConfig):
# update urls # update urls
self._update_urls() self._update_urls()
def _get_plugin_path(self, plugin):
try:
# for local path plugins
plugin_path = '.'.join(pathlib.Path(plugin.path).relative_to(settings.BASE_DIR).parts)
except ValueError:
# plugin is shipped as package
plugin_path = plugin.PLUGIN_NAME
return plugin_path
def deactivate_integration_app(self): def deactivate_integration_app(self):
# remove plugin from installed_apps # remove plugin from installed_apps
for plugin in settings.INTEGRATION_APPS_PATHS: for plugin in settings.INTEGRATION_APPS_PATHS: