-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix dispatcher when no plugins are given #332
base: master
Are you sure you want to change the base?
Fix dispatcher when no plugins are given #332
Conversation
When any plugin is using the dispatcher for nested actions it should pass all plugins again to avoid that any plugin as subtask would be handled. Currently this means a lot of plugins are broken because they don't pass plugins to the dispatcher. To fix this, take all Plugin subclasses when no plugin is given (we should at least have the default plugins).
Add test to verify that a plugin can run dispatch to handle subtasks of external plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this design will respect the --disable-built-in-plugins
option.
@@ -0,0 +1,17 @@ | |||
"""Test that a plugin can call dispatcher for subtasks. | |||
|
|||
The plugin calls dispatch with his data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plugin calls dispatch with his data. | |
The plugin calls dispatch with its data. |
@@ -18,7 +18,10 @@ def __init__( | |||
): | |||
self._log = Messenger() | |||
self._setup_context(base_directory, options) | |||
plugins = plugins or [] | |||
if plugins == None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please always use identity, not equality, comparisons with None
:
if plugins == None: | |
if plugins is None: |
@@ -18,7 +18,10 @@ def __init__( | |||
): | |||
self._log = Messenger() | |||
self._setup_context(base_directory, options) | |||
plugins = plugins or [] | |||
if plugins == None: | |||
plugins = Plugin.__subclasses__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will circumvent the configuration option --disable-built-in-plugins
. It will re-enable plugins that the user may have requested be disabled.
I've submitted #343 to address this, but I think that it will respect the As a side effect, #343 introduces a cached Dispatcher instance that plugins can begin leveraging -- they can simply access |
When any plugin is using the dispatcher for nested actions it should
pass all plugins again to avoid that any plugin as subtask would be
handled.
Currently this means a lot of plugins are broken because they don't pass
plugins to the dispatcher.
To fix this, take all Plugin subclasses when no plugin is given (we
should at least have the default plugins).