瀏覽代碼

fix(api): restful to restx migration issue (#24416)

tags/1.8.0
Matri Qi 2 月之前
父節點
當前提交
f31ddc4b1c
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 3 行新增15 行删除
  1. 1
    1
      api/fields/api_based_extension_fields.py
  2. 0
    12
      api/libs/external_api.py
  3. 2
    2
      api/libs/helper.py

+ 1
- 1
api/fields/api_based_extension_fields.py 查看文件

@@ -4,7 +4,7 @@ from libs.helper import TimestampField


class HiddenAPIKey(fields.Raw):
def output(self, key, obj):
def output(self, key, obj, **kwargs):
api_key = obj.api_key
# If the length of the api_key is less than 8 characters, show the first and last characters
if len(api_key) <= 8:

+ 0
- 12
api/libs/external_api.py 查看文件

@@ -77,18 +77,6 @@ class ExternalApi(Api):

data = getattr(e, "data", default_data)

error_cls_name = type(e).__name__
if error_cls_name in self.errors:
custom_data = self.errors.get(error_cls_name, {})
custom_data = custom_data.copy()
status_code = custom_data.get("status", 500)

if "message" in custom_data:
custom_data["message"] = custom_data["message"].format(
message=str(e.description if hasattr(e, "description") else e)
)
data.update(custom_data)

# record the exception in the logs when we have a server error of status code: 500
if status_code and status_code >= 500:
exc_info: Any = sys.exc_info()

+ 2
- 2
api/libs/helper.py 查看文件

@@ -57,7 +57,7 @@ def run(script):


class AppIconUrlField(fields.Raw):
def output(self, key, obj):
def output(self, key, obj, **kwargs):
if obj is None:
return None

@@ -72,7 +72,7 @@ class AppIconUrlField(fields.Raw):


class AvatarUrlField(fields.Raw):
def output(self, key, obj):
def output(self, key, obj, **kwargs):
if obj is None:
return None


Loading…
取消
儲存