Skip to content

Commit

Permalink
fix:send() sender参数字符串传参修改成对象
Browse files Browse the repository at this point in the history
  • Loading branch information
huangpixu committed Dec 5, 2024
1 parent 948a1dc commit ce2f2ae
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions gcloud/contrib/operate_record/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)


@receiver(operate_record_signal, sender=RecordType.template.name)
@receiver(operate_record_signal, sender=RecordType.template)
def record_template_handler(operator, operate_type, operate_source, instance_id, project_id, **kwargs):
record_template_operation_helper(
operator=operator,
Expand All @@ -33,14 +33,14 @@ def record_template_handler(operator, operate_type, operate_source, instance_id,
)


@receiver(operate_record_signal, sender=RecordType.common_template.name)
@receiver(operate_record_signal, sender=RecordType.common_template)
def record_common_template_handler(operator, operate_type, operate_source, instance_id, **kwargs):
record_template_operation_helper(
operator=operator, operate_type=operate_type, operate_source=operate_source, template_id=instance_id,
)


@receiver(operate_record_signal, sender=RecordType.task.name)
@receiver(operate_record_signal, sender=RecordType.task)
def record_task_handler(operator, operate_type, operate_source, instance_id, project_id, extra_info="", **kwargs):
record_task_operation_helper(
operator=operator,
Expand All @@ -52,7 +52,7 @@ def record_task_handler(operator, operate_type, operate_source, instance_id, pro
)


@receiver(operate_record_signal, sender=RecordType.task_node.name)
@receiver(operate_record_signal, sender=RecordType.task_node)
def record_task_node_handler(operator, operate_type, operate_source, instance_id, project_id, node_id, **kwargs):
record_task_operation_helper(
operator=operator,
Expand Down
6 changes: 3 additions & 3 deletions gcloud/core/apis/drf/viewsets/common_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def create(self, request, *args, **kwargs):
data = self.injection_auth_actions(request, serializer.data, serializer.instance)
# 记录操作流水
operate_record_signal.send(
sender=RecordType.common_template.name,
sender=RecordType.common_template,
operator=creator,
operate_type=OperateType.create.name,
operate_source=OperateSource.common.name,
Expand Down Expand Up @@ -259,7 +259,7 @@ def update(self, request, *args, **kwargs):
data = self.injection_auth_actions(request, serializer.data, template)
# 记录操作流水
operate_record_signal.send(
sender=RecordType.common_template.name,
sender=RecordType.common_template,
operator=editor,
operate_type=OperateType.update.name,
operate_source=OperateSource.common.name,
Expand All @@ -284,7 +284,7 @@ def destroy(self, request, *args, **kwargs):
self.perform_destroy(template)
# 记录操作流水
operate_record_signal.send(
sender=RecordType.common_template.name,
sender=RecordType.common_template,
operator=request.user.username,
operate_type=OperateType.delete.name,
operate_source=OperateSource.common.name,
Expand Down
6 changes: 3 additions & 3 deletions gcloud/core/apis/drf/viewsets/task_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def create(self, request, *args, **kwargs):
data = self.injection_auth_actions(request, serializer.data, serializer.instance)
# 记录操作流水
operate_record_signal.send(
sender=RecordType.template.name,
sender=RecordType.template,
operator=creator,
operate_type=OperateType.create.name,
operate_source=OperateSource.project.name,
Expand Down Expand Up @@ -302,7 +302,7 @@ def update(self, request, *args, **kwargs):
data = self.injection_auth_actions(request, serializer.data, template)
# 记录操作流水
operate_record_signal.send(
sender=RecordType.template.name,
sender=RecordType.template,
operator=editor,
operate_type=OperateType.update.name,
operate_source=OperateSource.project.name,
Expand Down Expand Up @@ -337,7 +337,7 @@ def destroy(self, request, *args, **kwargs):
)
# 记录操作流水
operate_record_signal.send(
sender=RecordType.template.name,
sender=RecordType.template,
operator=request.user.username,
operate_type=OperateType.delete.name,
operate_source=OperateSource.project.name,
Expand Down
4 changes: 2 additions & 2 deletions gcloud/core/apis/drf/viewsets/taskflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def perform_create(self, serializer):
extra_info = extract_extra_info(constants)
# 记录操作流水
operate_record_signal.send(
sender=RecordType.task.name,
sender=RecordType.task,
operator=pipeline_instance_kwargs["creator"],
operate_type=OperateType.create.name,
operate_source=OperateSource.app.name,
Expand Down Expand Up @@ -577,7 +577,7 @@ def destroy(self, request, *args, **kwargs):
self.perform_destroy(instance)
# 记录操作流水
operate_record_signal.send(
sender=RecordType.task.name,
sender=RecordType.task,
operator=self.request.user.username,
operate_type=OperateType.delete.name,
operate_source=OperateSource.app.name,
Expand Down
2 changes: 1 addition & 1 deletion packages/blueking/component/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ def get_signature(method, path, app_secret, params=None, data=None):
kwargs["data"] = data
kwargs = "&".join(["%s=%s" % (k, v) for k, v in sorted(list(kwargs.items()), key=lambda x: x[0])])
orignal = "%s%s?%s" % (method, path, kwargs)
signature = base64.b64encode(hmac.new(str(app_secret), orignal, hashlib.sha1).digest())
signature = base64.b64encode(hmac.new(str(app_secret), orignal, hashlib.sha256).digest())
return signature
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def execute(self, data, parent_data):
pipeline_constants = pipeline_instance.execution_data.get("constants")
extra_info = extract_extra_info(pipeline_constants)
operate_record_signal.send(
sender=RecordType.task.name,
sender=RecordType.task,
operator="system",
operate_type=OperateType.create.name,
operate_source=OperateSource.parent.name,
Expand All @@ -219,7 +219,7 @@ def execute(self, data, parent_data):

# 记录操作流水
operate_record_signal.send(
sender=RecordType.task.name,
sender=RecordType.task,
operator="system",
operate_type=OperateType.start.name,
operate_source=OperateSource.parent.name,
Expand Down

0 comments on commit ce2f2ae

Please sign in to comment.