Support for multiple positional arguments on utils.run()

This commit is contained in:
Fabio Manganiello 2020-04-09 23:50:08 +02:00
parent ca718d0748
commit 7b79e4b669

View file

@ -290,12 +290,12 @@ def is_functional_hook(obj) -> bool:
return callable(obj) and hasattr(obj, 'hook') return callable(obj) and hasattr(obj, 'hook')
def run(action, **kwargs): def run(action, *args, **kwargs):
from platypush.context import get_plugin from platypush.context import get_plugin
(module_name, method_name) = get_module_and_method_from_action(action) (module_name, method_name) = get_module_and_method_from_action(action)
plugin = get_plugin(module_name) plugin = get_plugin(module_name)
method = getattr(plugin, method_name) method = getattr(plugin, method_name)
return method(**kwargs) return method(*args, **kwargs)
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et: