Action handlers are no longer required to return a Tuple. If a handler just returns data, it is assumed that the data returned is a successful response. If the function returns in error, then the function should return a Tuple with the data first and boolean second.
Old Way:
def list_files(request: Request):
dir = request.dir
if not os.path.exists(dir):
return False, 'No such file or directory'
else:
return True, 'Here are your files!'
New Way:
def list_files(request: Request):
dir = request.dir
if not os.path.exist(dir):
return 'No such file or directory', False
else:
return 'Here are your files!'
======
Module developers can now register functions to be called on start and shutdown lifecycle events. This can be done manually by calling register_startup_handler(func) and register_shutdown_handler or by using the @on_start() and @on_shutdown() decorators.
Action handlers are no longer required to return a Tuple. If a handler just returns data, it is assumed that the data returned is a successful response. If the function returns in error, then the function should return a Tuple with the data first and boolean second.
Old Way:
New Way:
======
Module developers can now register functions to be called on start and shutdown lifecycle events. This can be done manually by calling
register_startup_handler(func)
andregister_shutdown_handler
or by using the@on_start()
and@on_shutdown()
decorators.Manual Examples:
Decorator Examples:
=====
Refactored existing modules to follow the new conventions.