Skip to content

fix: Resolve the error message#2149

Merged
wxg0103 merged 1 commit intomainfrom
pr@main@fix_1052045
Feb 7, 2025
Merged

fix: Resolve the error message#2149
wxg0103 merged 1 commit intomainfrom
pr@main@fix_1052045

Conversation

@shaohuzhang1
Copy link
Contributor

fix: Resolve the error message --bug=1052045 --user=王孝刚 【应用】-应用中使用的函数被删除后,演示中提示函数库被删除,提示错误 https://www.tapd.cn/57709429/s/1651371

--bug=1052045 --user=王孝刚 【应用】-应用中使用的函数被删除后,演示中提示函数库被删除,提示错误 https://www.tapd.cn/57709429/s/1651371
raise Exception(_('The function has been deleted'))


class IFunctionLibNode(INode):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no significant issues with the provided code snippet for ISubscription class. However, there's an inconsistency between the exception messages:

Exception Message Inconsistency:

-            raise Exception(_('The library has been deleted'))
+            raise Exception(_('The function has been deleted'))

Here, it looks like 'library' should be replaced with 'function' since you're dealing with function-related operations (FunctionLib). Adjusting this will ensure that the correct message is displayed.

Optimization Suggestion (optional):
If you want to make the check more efficient by filtering directly on a specific field when possible, consider changing:

f_lib = QuerySet(FunctionLib).filter(id=self.data.get('function_lib_id')).first()

to

f_lib = FunctionLib.objects.filter(pk=self.data['function_lib_id']).last()  # Assuming 'id' and 'pk' point to the same field

This approach assumes that FunctionLib.pk corresponds to the desired identifier field used in your database schema. Adjustments may need to be made if these fields differ or do not exist in your model.

These changes will improve readability and potentially performance based on the specifics of your database schema.

@wxg0103 wxg0103 merged commit b4d3939 into main Feb 7, 2025
4 checks passed
@wxg0103 wxg0103 deleted the pr@main@fix_1052045 branch February 7, 2025 06:28
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Feb 7, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Feb 7, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants