Skip to content

Commit

Permalink
Merge pull request #1568 from st1020/refactor/remove-match
Browse files Browse the repository at this point in the history
refactor: remove match statement
  • Loading branch information
Bidaya0 authored Jul 7, 2023
2 parents 0a7a84e + f9576ec commit 7359240
Showing 1 changed file with 10 additions and 11 deletions.
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

0 comments on commit 7359240

Please sign in to comment.