Correct use of middleware async handling. (#12078)
This commit is contained in:
parent
424fe95ce4
commit
40af9f2676
2 changed files with 4 additions and 4 deletions
|
@ -23,7 +23,7 @@ def auth_middleware(request, handler):
|
||||||
# If no password set, just always set authenticated=True
|
# If no password set, just always set authenticated=True
|
||||||
if request.app['hass'].http.api_password is None:
|
if request.app['hass'].http.api_password is None:
|
||||||
request[KEY_AUTHENTICATED] = True
|
request[KEY_AUTHENTICATED] = True
|
||||||
return handler(request)
|
return (yield from handler(request))
|
||||||
|
|
||||||
# Check authentication
|
# Check authentication
|
||||||
authenticated = False
|
authenticated = False
|
||||||
|
@ -46,7 +46,7 @@ def auth_middleware(request, handler):
|
||||||
authenticated = True
|
authenticated = True
|
||||||
|
|
||||||
request[KEY_AUTHENTICATED] = authenticated
|
request[KEY_AUTHENTICATED] = authenticated
|
||||||
return handler(request)
|
return (yield from handler(request))
|
||||||
|
|
||||||
|
|
||||||
def is_trusted_ip(request):
|
def is_trusted_ip(request):
|
||||||
|
|
|
@ -67,7 +67,7 @@ def staticresource_middleware(request, handler):
|
||||||
"""Middleware to strip out fingerprint from fingerprinted assets."""
|
"""Middleware to strip out fingerprint from fingerprinted assets."""
|
||||||
path = request.path
|
path = request.path
|
||||||
if not path.startswith('/static/') and not path.startswith('/frontend'):
|
if not path.startswith('/static/') and not path.startswith('/frontend'):
|
||||||
return handler(request)
|
return (yield from handler(request))
|
||||||
|
|
||||||
fingerprinted = _FINGERPRINT.match(request.match_info['filename'])
|
fingerprinted = _FINGERPRINT.match(request.match_info['filename'])
|
||||||
|
|
||||||
|
@ -75,4 +75,4 @@ def staticresource_middleware(request, handler):
|
||||||
request.match_info['filename'] = \
|
request.match_info['filename'] = \
|
||||||
'{}.{}'.format(*fingerprinted.groups())
|
'{}.{}'.format(*fingerprinted.groups())
|
||||||
|
|
||||||
return handler(request)
|
return (yield from handler(request))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue