Commit 2c6621f800489dc7f35b06ec331dcdd62a649a7e
Exists in
master
and in
28 other branches
Merge branch 'fix_plugins_app_label' into 'master'
Fix plugins app label Fix plugins with path with namespace... for example colab.plugins.gitlab See merge request !92
Showing
3 changed files
with
6 additions
and
8 deletions
Show diff stats
colab/search/utils.py
... | ... | @@ -57,10 +57,8 @@ def get_collaboration_data(logged_user, filter_by_user=None): |
57 | 57 | |
58 | 58 | latest_results.extend(messages) |
59 | 59 | |
60 | - app_names = settings.COLAB_APPS.keys() | |
61 | - | |
62 | - for app_name in app_names: | |
63 | - module = importlib.import_module('{}.models'.format(app_name)) | |
60 | + for app in settings.COLAB_APPS.values(): | |
61 | + module = importlib.import_module('{}.models'.format(app.get('name'))) | |
64 | 62 | |
65 | 63 | for module_item_name in dir(module): |
66 | 64 | module_item = getattr(module, module_item_name) | ... | ... |
colab/settings.py
... | ... | @@ -266,8 +266,8 @@ for app_name, app in COLAB_APPS.items(): |
266 | 266 | if dep not in INSTALLED_APPS: |
267 | 267 | INSTALLED_APPS += (dep,) |
268 | 268 | |
269 | - if app_name not in INSTALLED_APPS: | |
270 | - INSTALLED_APPS += (app_name,) | |
269 | + if app.get('name') not in INSTALLED_APPS: | |
270 | + INSTALLED_APPS += (app.get('name'),) | |
271 | 271 | |
272 | 272 | if 'middlewares' in app: |
273 | 273 | for middleware in app.get('middlewares'): | ... | ... |
colab/utils/conf.py
... | ... | @@ -104,7 +104,7 @@ def load_colab_apps(): |
104 | 104 | app_name = file_name |
105 | 105 | |
106 | 106 | elif file_name.endswith('.py'): |
107 | - app_name = py_settings_d.get('name') | |
107 | + app_name = py_settings_d.get('name').split('.')[-1] | |
108 | 108 | |
109 | 109 | if not app_name: |
110 | 110 | logger.warning("Plugin missing name variable (%s)", file_name) |
... | ... | @@ -121,7 +121,7 @@ def load_colab_apps(): |
121 | 121 | |
122 | 122 | fields = ['verbose_name', 'upstream', 'urls', |
123 | 123 | 'menu_urls', 'middlewares', 'dependencies', |
124 | - 'context_processors', 'private_token'] | |
124 | + 'context_processors', 'private_token', 'name'] | |
125 | 125 | |
126 | 126 | for key in fields: |
127 | 127 | value = py_settings_d.get(key) | ... | ... |