From 9d1e72cdd88caf2e668d91ac6fc20abf6fe9be45 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 18 Mar 2020 09:39:41 +0100 Subject: [PATCH] call and publish only with positionals arguments --- src/risotto/controller.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/risotto/controller.py b/src/risotto/controller.py index 1a829b8a..663c5e5a 100644 --- a/src/risotto/controller.py +++ b/src/risotto/controller.py @@ -3,6 +3,7 @@ from .dispatcher import dispatcher from .context import Context from .remote import remote from .services import list_modules +from .utils import _ class Controller: @@ -15,10 +16,13 @@ class Controller: async def call(self, uri: str, risotto_context: Context, + *args, **kwargs): """ a wrapper to dispatcher's call""" version, module, message = uri.split('.', 2) uri = module + '.' + message + if args: + raise ValueError(_(f'the URI "{uri}" can only be called with positionals arguments')) if module not in self.risotto_modules: return await remote.remove_call(module, version, @@ -32,10 +36,13 @@ class Controller: async def publish(self, uri: str, risotto_context: Context, + *args, **kwargs): """ a wrapper to dispatcher's publish""" version, module, submessage = uri.split('.', 2) version, message = uri.split('.', 1) + if args: + raise ValueError(_(f'the URI "{uri}" can only be published with positionals arguments')) if module not in self.risotto_modules: await remote.remove_call(module, version,