call and publish only with positionals arguments
This commit is contained in:
parent
eef7f02512
commit
9d1e72cdd8
|
@ -3,6 +3,7 @@ from .dispatcher import dispatcher
|
||||||
from .context import Context
|
from .context import Context
|
||||||
from .remote import remote
|
from .remote import remote
|
||||||
from .services import list_modules
|
from .services import list_modules
|
||||||
|
from .utils import _
|
||||||
|
|
||||||
|
|
||||||
class Controller:
|
class Controller:
|
||||||
|
@ -15,10 +16,13 @@ class Controller:
|
||||||
async def call(self,
|
async def call(self,
|
||||||
uri: str,
|
uri: str,
|
||||||
risotto_context: Context,
|
risotto_context: Context,
|
||||||
|
*args,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
""" a wrapper to dispatcher's call"""
|
""" a wrapper to dispatcher's call"""
|
||||||
version, module, message = uri.split('.', 2)
|
version, module, message = uri.split('.', 2)
|
||||||
uri = module + '.' + message
|
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:
|
if module not in self.risotto_modules:
|
||||||
return await remote.remove_call(module,
|
return await remote.remove_call(module,
|
||||||
version,
|
version,
|
||||||
|
@ -32,10 +36,13 @@ class Controller:
|
||||||
async def publish(self,
|
async def publish(self,
|
||||||
uri: str,
|
uri: str,
|
||||||
risotto_context: Context,
|
risotto_context: Context,
|
||||||
|
*args,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
""" a wrapper to dispatcher's publish"""
|
""" a wrapper to dispatcher's publish"""
|
||||||
version, module, submessage = uri.split('.', 2)
|
version, module, submessage = uri.split('.', 2)
|
||||||
version, message = uri.split('.', 1)
|
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:
|
if module not in self.risotto_modules:
|
||||||
await remote.remove_call(module,
|
await remote.remove_call(module,
|
||||||
version,
|
version,
|
||||||
|
|
Loading…
Reference in New Issue