mirror of https://github.com/jumpserver/jumpserver
perf: 优化 setting 读取,避免遗漏
parent
c692eed3c6
commit
4f37b2b920
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue