mirror of https://github.com/snachodog/mybuddy.git
Black
This commit is contained in:
parent
c716334f02
commit
c1eb9da7f3
|
@ -10,6 +10,7 @@ from django.utils import timezone, translation
|
|||
from django.contrib.auth.middleware import RemoteUserMiddleware
|
||||
from django.http import HttpRequest
|
||||
|
||||
|
||||
class UserLanguageMiddleware:
|
||||
"""
|
||||
Customizes settings based on user language setting.
|
||||
|
@ -139,11 +140,10 @@ class HomeAssistant:
|
|||
url_parts._replace(path=x_ingress_path + url_parts.path)
|
||||
)
|
||||
return url
|
||||
|
||||
return wrapper
|
||||
|
||||
request.build_absolute_uri = wrap_x_ingress_path(
|
||||
request.build_absolute_uri
|
||||
)
|
||||
request.build_absolute_uri = wrap_x_ingress_path(request.build_absolute_uri)
|
||||
|
||||
def __call__(self, request: HttpRequest):
|
||||
if self.home_assistant_support_enabled:
|
||||
|
@ -156,4 +156,3 @@ class HomeAssistant:
|
|||
self.__wrap_build_absolute_uri(request)
|
||||
|
||||
return self.get_response(request)
|
||||
|
|
@ -67,4 +67,6 @@ class HomeAssistantMiddlewareTestCase(TestCase):
|
|||
)
|
||||
json_response = json.loads(response.content)
|
||||
|
||||
self.assertEqual(json_response["profile"], "http://testserver/magic/sub/url/api/profile")
|
||||
self.assertEqual(
|
||||
json_response["profile"], "http://testserver/magic/sub/url/api/profile"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue