Compare commits
No commits in common. "98c77bf71904796a3ebb8c01e39f4a859a67f80d" and "1b9d87fa5370fdea7f83741a06bd473241c8e6ad" have entirely different histories.
98c77bf719
...
1b9d87fa53
|
@ -394,9 +394,10 @@ class Dispatcher(register.RegisterDispatcher,
|
||||||
) -> Optional[Dict]:
|
) -> Optional[Dict]:
|
||||||
# so send the message
|
# so send the message
|
||||||
function = function_obj['function']
|
function = function_obj['function']
|
||||||
risotto_context.module = function_obj['module'].split('.', 1)[0]
|
submodule_name = function_obj['module']
|
||||||
function_name = function.__name__
|
function_name = function.__name__
|
||||||
info_msg = _(f"in function {function_obj['full_module_name']}.{function_name}")
|
risotto_context.module = submodule_name.split('.', 1)[0]
|
||||||
|
info_msg = _(f'in module {submodule_name}.{function_name}')
|
||||||
# build argument for this function
|
# build argument for this function
|
||||||
if risotto_context.type == 'rpc':
|
if risotto_context.type == 'rpc':
|
||||||
kw = config_arguments
|
kw = config_arguments
|
||||||
|
|
|
@ -199,8 +199,7 @@ class RegisterDispatcher:
|
||||||
raise RegistrationError(_(f'the message {message} not exists'))
|
raise RegistrationError(_(f'the message {message} not exists'))
|
||||||
|
|
||||||
# xxx submodule can only be register with v1.yyy.xxx..... message
|
# xxx submodule can only be register with v1.yyy.xxx..... message
|
||||||
full_module_name = function.__module__
|
risotto_module_name, submodule_name = function.__module__.split('.')[-3:-1]
|
||||||
risotto_module_name, submodule_name = full_module_name.split('.')[-3:-1]
|
|
||||||
module_name = risotto_module_name.split('_')[-1]
|
module_name = risotto_module_name.split('_')[-1]
|
||||||
message_module, message_submodule, message_name = message.split('.', 2)
|
message_module, message_submodule, message_name = message.split('.', 2)
|
||||||
if message_module not in self.risotto_modules:
|
if message_module not in self.risotto_modules:
|
||||||
|
@ -225,7 +224,6 @@ class RegisterDispatcher:
|
||||||
register(version,
|
register(version,
|
||||||
message,
|
message,
|
||||||
f'{module_name}.{submodule_name}',
|
f'{module_name}.{submodule_name}',
|
||||||
full_module_name,
|
|
||||||
function,
|
function,
|
||||||
function_args,
|
function_args,
|
||||||
notification,
|
notification,
|
||||||
|
@ -235,13 +233,11 @@ class RegisterDispatcher:
|
||||||
version: str,
|
version: str,
|
||||||
message: str,
|
message: str,
|
||||||
module_name: str,
|
module_name: str,
|
||||||
full_module_name: str,
|
|
||||||
function: Callable,
|
function: Callable,
|
||||||
function_args: list,
|
function_args: list,
|
||||||
notification: Optional[str],
|
notification: Optional[str],
|
||||||
):
|
):
|
||||||
self.messages[version][message]['module'] = module_name
|
self.messages[version][message]['module'] = module_name
|
||||||
self.messages[version][message]['full_module_name'] = full_module_name
|
|
||||||
self.messages[version][message]['function'] = function
|
self.messages[version][message]['function'] = function
|
||||||
self.messages[version][message]['arguments'] = function_args
|
self.messages[version][message]['arguments'] = function_args
|
||||||
if notification:
|
if notification:
|
||||||
|
@ -251,7 +247,6 @@ class RegisterDispatcher:
|
||||||
version: str,
|
version: str,
|
||||||
message: str,
|
message: str,
|
||||||
module_name: str,
|
module_name: str,
|
||||||
full_module_name: str,
|
|
||||||
function: Callable,
|
function: Callable,
|
||||||
function_args: list,
|
function_args: list,
|
||||||
notification: Optional[str],
|
notification: Optional[str],
|
||||||
|
@ -260,10 +255,8 @@ class RegisterDispatcher:
|
||||||
self.messages[version][message]['functions'] = []
|
self.messages[version][message]['functions'] = []
|
||||||
|
|
||||||
dico = {'module': module_name,
|
dico = {'module': module_name,
|
||||||
'full_module_name': full_module_name,
|
|
||||||
'function': function,
|
'function': function,
|
||||||
'arguments': function_args,
|
'arguments': function_args}
|
||||||
}
|
|
||||||
if notification and notification:
|
if notification and notification:
|
||||||
dico['notification'] = notification
|
dico['notification'] = notification
|
||||||
self.messages[version][message]['functions'].append(dico)
|
self.messages[version][message]['functions'].append(dico)
|
||||||
|
@ -316,7 +309,7 @@ class RegisterDispatcher:
|
||||||
risotto_context.type = None
|
risotto_context.type = None
|
||||||
risotto_context.connection = connection
|
risotto_context.connection = connection
|
||||||
risotto_context.module = submodule_name.split('.', 1)[0]
|
risotto_context.module = submodule_name.split('.', 1)[0]
|
||||||
info_msg = _(f'in function risotto_{submodule_name}.on_join')
|
info_msg = _(f'in module risotto_{submodule_name}.on_join')
|
||||||
await log.info_msg(risotto_context,
|
await log.info_msg(risotto_context,
|
||||||
None,
|
None,
|
||||||
info_msg)
|
info_msg)
|
||||||
|
|
Loading…
Reference in New Issue