mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-09 11:19:08 +00:00
perf: 优化 setting 读取,避免遗漏
This commit is contained in:
@@ -41,14 +41,6 @@ class PublicSettingApi(OpenPublicSettingApi):
|
|||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
values = super().get_object()
|
values = super().get_object()
|
||||||
|
|
||||||
serializer = self.serializer_class()
|
|
||||||
field_names = list(serializer.fields.keys())
|
|
||||||
|
|
||||||
for name in field_names:
|
|
||||||
if hasattr(settings, name):
|
|
||||||
values[name] = getattr(settings, name)
|
|
||||||
|
|
||||||
values.update({
|
values.update({
|
||||||
"XPACK_LICENSE_IS_VALID": has_valid_xpack_license(),
|
"XPACK_LICENSE_IS_VALID": has_valid_xpack_license(),
|
||||||
"XPACK_LICENSE_INFO": get_xpack_license_info(),
|
"XPACK_LICENSE_INFO": get_xpack_license_info(),
|
||||||
@@ -61,6 +53,15 @@ class PublicSettingApi(OpenPublicSettingApi):
|
|||||||
'SECURITY_PASSWORD_SPECIAL_CHAR': settings.SECURITY_PASSWORD_SPECIAL_CHAR,
|
'SECURITY_PASSWORD_SPECIAL_CHAR': settings.SECURITY_PASSWORD_SPECIAL_CHAR,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
serializer = self.serializer_class()
|
||||||
|
field_names = list(serializer.fields.keys())
|
||||||
|
for name in field_names:
|
||||||
|
if name in values:
|
||||||
|
continue
|
||||||
|
# 提前把异常爆出来
|
||||||
|
values[name] = getattr(settings, name)
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user