mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
work on Response model
This commit is contained in:
@@ -7,6 +7,13 @@ class Response:
|
||||
valid_flags: ValidInputFlags = ValidInputFlags(),
|
||||
undefined_flags: UndefinedInputFlags = UndefinedInputFlags(),
|
||||
invalid_value_flags: InvalidValueInputFlags = InvalidValueInputFlags()):
|
||||
"""
|
||||
Public. The entity of the user input sent to the handler
|
||||
:param status: the status of the response
|
||||
:param valid_flags: valid input flags
|
||||
:param undefined_flags: undefined input flags
|
||||
:param invalid_value_flags: input flags with invalid values
|
||||
"""
|
||||
self.status = status
|
||||
self.valid_flags = valid_flags
|
||||
self.undefined_flags = undefined_flags
|
||||
|
||||
@@ -34,7 +34,7 @@ class Router:
|
||||
self._validate_command(command)
|
||||
|
||||
def command_decorator(func):
|
||||
Router._validate_func_args(command, func)
|
||||
Router._validate_func_args(func)
|
||||
self._command_handlers.add_handler(CommandHandler(func, command))
|
||||
|
||||
def wrapper(*args, **kwargs):
|
||||
@@ -134,10 +134,9 @@ class Router:
|
||||
|
||||
|
||||
@staticmethod
|
||||
def _validate_func_args(command: Command, func: Callable) -> None:
|
||||
def _validate_func_args(func: Callable) -> None:
|
||||
"""
|
||||
Private. Validates the arguments of the handler
|
||||
:param command: registered command in handler
|
||||
:param func: entity of the handler func
|
||||
:return: None if func is valid else raise exception
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user