move imports

This commit is contained in:
Matthias 2021-11-20 03:52:27 +01:00
parent 4b3d5b27a6
commit 9f0882d637
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 5 additions and 4 deletions

View File

@ -24,8 +24,6 @@ except:
from maintenance_mode.core import maintenance_mode_on from maintenance_mode.core import maintenance_mode_on
from maintenance_mode.core import get_maintenance_mode, set_maintenance_mode from maintenance_mode.core import get_maintenance_mode, set_maintenance_mode
from InvenTree.helpers import log_plugin_error
from plugin import plugins as inventree_plugins from plugin import plugins as inventree_plugins
from plugin.integration import IntegrationPluginBase from plugin.integration import IntegrationPluginBase
@ -53,6 +51,8 @@ class PluginAppConfig(AppConfig):
# region public plugin functions # region public plugin functions
def load_plugins(self): def load_plugins(self):
"""load and activate all IntegrationPlugins""" """load and activate all IntegrationPlugins"""
from InvenTree.helpers import log_plugin_error
logger.info('Start loading plugins') logger.info('Start loading plugins')
# set maintanace mode # set maintanace mode
_maintenance = bool(get_maintenance_mode()) _maintenance = bool(get_maintenance_mode())
@ -143,6 +143,7 @@ class PluginAppConfig(AppConfig):
:type disabled: str, optional :type disabled: str, optional
:raises error: PluginLoadingError :raises error: PluginLoadingError
""" """
from InvenTree.helpers import log_plugin_error
from plugin.models import PluginConfig from plugin.models import PluginConfig
logger.info('Starting plugin initialisation') logger.info('Starting plugin initialisation')

View File

@ -9,8 +9,6 @@ import logging
from django.conf import settings from django.conf import settings
from django.core.exceptions import AppRegistryNotReady from django.core.exceptions import AppRegistryNotReady
from InvenTree.helpers import log_plugin_error
# Action plugins # Action plugins
import plugin.builtin.action as action import plugin.builtin.action as action
from plugin.action import ActionPlugin from plugin.action import ActionPlugin
@ -29,6 +27,8 @@ def iter_namespace(pkg):
def get_modules(pkg, recursive: bool = False): def get_modules(pkg, recursive: bool = False):
"""get all modules in a package""" """get all modules in a package"""
from InvenTree.helpers import log_plugin_error
if not recursive: if not recursive:
return [importlib.import_module(name) for finder, name, ispkg in iter_namespace(pkg)] return [importlib.import_module(name) for finder, name, ispkg in iter_namespace(pkg)]