call and publish only with positionals arguments

This commit is contained in:
Emmanuel Garette 2020-03-18 09:39:41 +01:00
parent eef7f02512
commit 9d1e72cdd8
1 changed files with 7 additions and 0 deletions

View File

@ -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,