Use HTTP_BAD_REQUEST constant (#33797)

This commit is contained in:
springstan 2020-04-09 21:43:42 +02:00 committed by GitHub
parent d510384c0d
commit 4c38e6cfa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 111 additions and 61 deletions

View file

@ -5,6 +5,7 @@ import logging
from aiohttp import web
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import HTTP_BAD_REQUEST
from homeassistant.helpers.typing import HomeAssistantType
from .const import ATTR_ADMIN, ATTR_ENABLE, ATTR_ICON, ATTR_PANELS, ATTR_TITLE
@ -52,7 +53,7 @@ class HassIOAddonPanel(HomeAssistantView):
# Panel exists for add-on slug
if addon not in panels or not panels[addon][ATTR_ENABLE]:
_LOGGER.error("Panel is not enable for %s", addon)
return web.Response(status=400)
return web.Response(status=HTTP_BAD_REQUEST)
data = panels[addon]
# Register panel