mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-10 19:40:16 +00:00
Refacture version handling with AwesomeVersion (#2392)
* Refacture version handling with AwesomeVersion Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * next Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * next Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * next Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * v20.12.3 Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * next Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * next Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * fix exception * fix schema * cleanup plugins * fix tests * fix attach * fix TypeError * fix issue with compairing * make lint happy * Update supervisor/homeassistant/__init__.py Co-authored-by: Joakim Sørensen <joasoe@gmail.com> * Update tests/test_validate.py Co-authored-by: Joakim Sørensen <joasoe@gmail.com> * Update supervisor/docker/__init__.py Co-authored-by: Joakim Sørensen <joasoe@gmail.com> * Update supervisor/supervisor.py Co-authored-by: Joakim Sørensen <joasoe@gmail.com> Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ from ..const import (
|
||||
)
|
||||
from ..exceptions import APIError, APIForbidden, DockerAPIError, HassioError
|
||||
from ..utils import check_exception_chain, get_message_from_exception_chain
|
||||
from ..utils.json import JSONEncoder
|
||||
from ..utils.log_format import format_message
|
||||
|
||||
|
||||
@@ -112,12 +113,16 @@ def api_return_error(
|
||||
JSON_MESSAGE: message or "Unknown error, see supervisor",
|
||||
},
|
||||
status=400,
|
||||
dumps=lambda x: json.dumps(x, cls=JSONEncoder),
|
||||
)
|
||||
|
||||
|
||||
def api_return_ok(data: Optional[Dict[str, Any]] = None) -> web.Response:
|
||||
"""Return an API ok answer."""
|
||||
return web.json_response({JSON_RESULT: RESULT_OK, JSON_DATA: data or {}})
|
||||
return web.json_response(
|
||||
{JSON_RESULT: RESULT_OK, JSON_DATA: data or {}},
|
||||
dumps=lambda x: json.dumps(x, cls=JSONEncoder),
|
||||
)
|
||||
|
||||
|
||||
async def api_validate(
|
||||
|
||||
Reference in New Issue
Block a user