diff --git a/babybuddy/middleware.py b/babybuddy/middleware.py index c52e2ca2..ea4931a6 100644 --- a/babybuddy/middleware.py +++ b/babybuddy/middleware.py @@ -9,6 +9,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. @@ -113,6 +114,7 @@ class HomeAssistant: ) return url + return wrapper request.is_homeassistant_ingress_request = ( @@ -120,10 +122,6 @@ class HomeAssistant: ) if self.use_x_ingress_path_rewrite: - request.build_absolute_uri = wrap_x_ingress_path( - request.build_absolute_uri - ) + request.build_absolute_uri = wrap_x_ingress_path(request.build_absolute_uri) return self.get_response(request) - - \ No newline at end of file diff --git a/babybuddy/views.py b/babybuddy/views.py index 6e1b7df4..bb472624 100644 --- a/babybuddy/views.py +++ b/babybuddy/views.py @@ -255,17 +255,12 @@ class UserAddDevice(LoginRequiredMixin, View): def get(self, request): session_cookies = {} if request.is_homeassistant_ingress_request: - session_cookies["ingress_session"] = ( - request.COOKIES.get("ingress_session") - ) + session_cookies["ingress_session"] = request.COOKIES.get("ingress_session") qr_code_response = render( request, self.qr_code_template, - { - "session_cookies": json.dumps(session_cookies) - } - + {"session_cookies": json.dumps(session_cookies)}, ) qr_code_data = qr_code_response.content.decode().strip()