1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

delete-trans-inn-sysadmin-web-settings-api (#4311)

This commit is contained in:
Leo
2019-11-27 16:25:26 +08:00
committed by Daniel Pan
parent f6ad244e0b
commit 2bcb9f5e8e

View File

@@ -65,22 +65,22 @@ class AdminWebSettings(APIView):
for key, value in request.data.items(): for key, value in request.data.items():
if key not in DIGIT_WEB_SETTINGS and key not in STRING_WEB_SETTINGS: if key not in DIGIT_WEB_SETTINGS and key not in STRING_WEB_SETTINGS:
error_msg = _(u'setting invalid.') error_msg = 'setting invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
if key in DIGIT_WEB_SETTINGS: if key in DIGIT_WEB_SETTINGS:
if not value.isdigit(): if not value.isdigit():
error_msg = _(u'value invalid.') error_msg = 'value invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
else: else:
value = int(value) value = int(value)
if key == 'USER_PASSWORD_STRENGTH_LEVEL' and value not in (1, 2, 3, 4): if key == 'USER_PASSWORD_STRENGTH_LEVEL' and value not in (1, 2, 3, 4):
error_msg = _(u'value invalid.') error_msg = 'value invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
if (key in STRING_WEB_SETTINGS and key != 'CUSTOM_CSS') and not value: if (key in STRING_WEB_SETTINGS and key != 'CUSTOM_CSS') and not value:
error_msg = _(u'value invalid.') error_msg = 'value invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
try: try: