Commit de987cd67a02ade902894810b2fa641583bfc880
1 parent
c1d77c04
Exists in
master
and in
17 other branches
Fixing app_label for importing module
Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com> Signed-off-by: Lucas Moura <lucas.moura128@gmail.com> Signed-off-by: Macartur Sousa <macartur.sc@gmail.com> Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com> Signed-off-by: Matheus Faria <matheus.sousa.faria@gmail.com> Signed-off-by: Sergio Oliveira <sergio@tracy.com.br>
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
colab/utils/conf.py
| ... | ... | @@ -102,13 +102,14 @@ def load_colab_apps(): |
| 102 | 102 | |
| 103 | 103 | logger.info('Loading plugin settings: %s%s', plugins_dir, file_name) |
| 104 | 104 | |
| 105 | + # FIXME Drop plugins in plugins.d directory | |
| 105 | 106 | if os.path.isdir(os.path.join(plugins_dir, file_name)): |
| 106 | 107 | py_settings_d = _load_py_file(file_module, plugins_dir) |
| 107 | 108 | app_name = file_name |
| 108 | 109 | |
| 109 | 110 | elif file_name.endswith('.py'): |
| 110 | 111 | py_settings_d = _load_py_file(file_module, plugins_dir) |
| 111 | - app_name = py_settings_d.get('name', '').split('.')[-1] | |
| 112 | + app_name = py_settings_d.get('name', '') | |
| 112 | 113 | |
| 113 | 114 | else: |
| 114 | 115 | logger.info("Not a plugin config: %s", file_name) |
| ... | ... | @@ -124,8 +125,9 @@ def load_colab_apps(): |
| 124 | 125 | logger.warning("Cannot import plugin %s (%s)", app_name, file_name) |
| 125 | 126 | continue |
| 126 | 127 | |
| 127 | - COLAB_APPS[app_name] = {} | |
| 128 | - COLAB_APPS[app_name]['menu_title'] = py_settings_d.get('menu_title') | |
| 128 | + app_label = app_name.split('.')[-1] | |
| 129 | + COLAB_APPS[app_label] = {} | |
| 130 | + COLAB_APPS[app_label]['menu_title'] = py_settings_d.get('menu_title') | |
| 129 | 131 | |
| 130 | 132 | fields = ['verbose_name', 'upstream', 'urls', |
| 131 | 133 | 'menu_urls', 'middlewares', 'dependencies', |
| ... | ... | @@ -134,7 +136,7 @@ def load_colab_apps(): |
| 134 | 136 | for key in fields: |
| 135 | 137 | value = py_settings_d.get(key) |
| 136 | 138 | if value: |
| 137 | - COLAB_APPS[app_name][key] = value | |
| 139 | + COLAB_APPS[app_label][key] = value | |
| 138 | 140 | |
| 139 | 141 | return {'COLAB_APPS': COLAB_APPS} |
| 140 | 142 | ... | ... |