Skip to content

Commit

Permalink
Merge branch 'staging_connect' into develop_connect
Browse files Browse the repository at this point in the history
  • Loading branch information
mldzs committed Apr 16, 2021
2 parents fe52bdc + 20a74c2 commit d2ae67d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bothub/api/v2/middleware.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from django.utils import translation
from django.utils.deprecation import MiddlewareMixin


class UserLanguageMiddleware(MiddlewareMixin):
def process_response(self, request, response):
class UserLanguageMiddleware:
def __init__(self, get_response):
self.get_response = get_response

def __call__(self, request):
user = getattr(request, "user", None)
if not user or user.is_anonymous:
return self.get_response(request)
Expand All @@ -15,4 +17,5 @@ def process_response(self, request, response):
translation.activate(user_language)

response = self.get_response(request)

return response

0 comments on commit d2ae67d

Please sign in to comment.