Revert "fix: 修复平台自动化翻译 (#12078)" (#12138)

This reverts commit 69c0eb2f50.
pull/12141/head
Bryan 2023-11-16 16:35:08 +08:00 committed by GitHub
parent d1391cb5d5
commit 9e10029bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 25 deletions

View File

@ -61,8 +61,8 @@ class AllTypes(ChoicesMixin):
@classmethod
def get_automation_methods(cls):
from assets.automations.methods import platform_automation_methods as asset_methods
from accounts.automations.methods import platform_automation_methods as account_methods
from assets.automations import platform_automation_methods as asset_methods
from accounts.automations import platform_automation_methods as account_methods
return asset_methods + account_methods
@classmethod

View File

@ -142,25 +142,3 @@ class EndMiddleware:
response = self.get_response(request)
request._e_time_end = time.time()
return response
class TranslatePatchMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
from assets.automations import methods as assets
from accounts.automations import methods as accounts
language = request.LANGUAGE_CODE
if language != settings.LANGUAGE_CODE:
settings.LANGUAGE_CODE = language
assets.platform_automation_methods = \
assets.get_platform_automation_methods(
assets.BASE_DIR
)
accounts.platform_automation_methods = \
accounts.get_platform_automation_methods(
accounts.BASE_DIR
)
response = self.get_response(request)
return response

View File

@ -160,7 +160,6 @@ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'jumpserver.middleware.TranslatePatchMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',