HTTP: Fix registering views after start (#4604)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2016-11-27 14:01:12 -08:00
1 parent ff4cb23f2a
commit 0d734303a4
2 files changed
+51

No files matched your search

+11
View File
@@ -289,10 +289,21 @@ class HomeAssistantWSGI(object):
else:
context = None
# Aiohttp freezes apps after start so that no changes can be made.
# However in Home Assistant components can be discovered after boot.
# This will now raise a RunTimeError.
# To work around this we now fake that we are frozen.
# A more appropriate fix would be to create a new app and
# re-register all redirects, views, static paths.
self.app._frozen = True # pylint: disable=protected-access
self._handler = self.app.make_handler()
self.server = yield from self.hass.loop.create_server(
self._handler, self.server_host, self.server_port, ssl=context)
self.app._frozen = False # pylint: disable=protected-access
@asyncio.coroutine
def stop(self):
"""Stop the wsgi server."""