Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove match statement #1568

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions dongtai_common/endpoint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,16 @@ def dispatch(self, request, *args, **kwargs):
if operate_tag:
operate_method = operate_tag[0].lstrip("operate-")

match operate_method:
case "GET":
operate_type = OperateType.GET
case "POST":
operate_type = OperateType.ADD
case "PUT":
operate_type = OperateType.CHANGE
case "DELETE":
operate_type = OperateType.DELETE
case _:
raise ValueError("unknown request method")
if operate_method == "GET":
operate_type = OperateType.GET
elif operate_method == "POST":
operate_type = OperateType.ADD
elif operate_method == "PUT":
operate_type = OperateType.CHANGE
elif operate_method == "DELETE":
operate_type = OperateType.DELETE
else:
raise ValueError("unknown request method")

IastLog.objects.create(
url=path,
Expand Down
Loading