Commit 721677c80cdf139dca44edb58149c5178218d9d7
1 parent
fd747671
Exists in
master
and in
29 other branches
Added warning when trying to import plugin from wrong path
Signed-off-by: Sergio Oliveira <sergio@tracy.com.br>
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
colab/utils/conf.py
@@ -10,7 +10,7 @@ from django.core.exceptions import ImproperlyConfigured | @@ -10,7 +10,7 @@ from django.core.exceptions import ImproperlyConfigured | ||
10 | logger = logging.getLogger('colab.init') | 10 | logger = logging.getLogger('colab.init') |
11 | if os.environ.get('COLAB_DEBUG'): | 11 | if os.environ.get('COLAB_DEBUG'): |
12 | logger.addHandler(logging.StreamHandler()) | 12 | logger.addHandler(logging.StreamHandler()) |
13 | - logger.setLevel(logging.INFO) | 13 | + logger.setLevel(logging.DEBUG) |
14 | 14 | ||
15 | 15 | ||
16 | class InaccessibleSettings(ImproperlyConfigured): | 16 | class InaccessibleSettings(ImproperlyConfigured): |
@@ -107,6 +107,11 @@ def load_colab_apps(): | @@ -107,6 +107,11 @@ def load_colab_apps(): | ||
107 | if not app_name: | 107 | if not app_name: |
108 | warnings.warn("Plugin missing name variable") | 108 | warnings.warn("Plugin missing name variable") |
109 | continue | 109 | continue |
110 | + try: | ||
111 | + importlib.import_module(app_name) | ||
112 | + except ImportError: | ||
113 | + logger.warning("Cannot import plugin %s (%s)", app_name, file_name) | ||
114 | + continue | ||
110 | 115 | ||
111 | COLAB_APPS[app_name] = {} | 116 | COLAB_APPS[app_name] = {} |
112 | COLAB_APPS[app_name]['menu_title'] = py_settings_d.get('menu_title') | 117 | COLAB_APPS[app_name]['menu_title'] = py_settings_d.get('menu_title') |