root: fix override locale only if it is not empty (#12283)
* update impersonate middleware override language only if it's not empty Signed-off-by: Zhang Jie <13131481+j-z10@users.noreply.github.com> * Update brands locale scope Signed-off-by: Zhang Jie <13131481+j-z10@users.noreply.github.com> --------- Signed-off-by: Zhang Jie <13131481+j-z10@users.noreply.github.com>
This commit is contained in:
		@ -25,5 +25,7 @@ class BrandMiddleware:
 | 
				
			|||||||
            locale = brand.default_locale
 | 
					            locale = brand.default_locale
 | 
				
			||||||
            if locale != "":
 | 
					            if locale != "":
 | 
				
			||||||
                locale_to_set = locale
 | 
					                locale_to_set = locale
 | 
				
			||||||
        with override(locale_to_set):
 | 
					        if locale_to_set:
 | 
				
			||||||
            return self.get_response(request)
 | 
					            with override(locale_to_set):
 | 
				
			||||||
 | 
					                return self.get_response(request)
 | 
				
			||||||
 | 
					        return self.get_response(request)
 | 
				
			||||||
 | 
				
			|||||||
@ -42,8 +42,10 @@ class ImpersonateMiddleware:
 | 
				
			|||||||
            # Ensure that the user is active, otherwise nothing will work
 | 
					            # Ensure that the user is active, otherwise nothing will work
 | 
				
			||||||
            request.user.is_active = True
 | 
					            request.user.is_active = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with override(locale_to_set):
 | 
					        if locale_to_set:
 | 
				
			||||||
            return self.get_response(request)
 | 
					            with override(locale_to_set):
 | 
				
			||||||
 | 
					                return self.get_response(request)
 | 
				
			||||||
 | 
					        return self.get_response(request)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RequestIDMiddleware:
 | 
					class RequestIDMiddleware:
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user