fix: Local rearrangement model cannot be added#4510
Conversation
|
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. DetailsInstructions 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-sigs/prow repository. |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| return model | ||
|
|
||
| cache_folder = forms.TextInputField(_('Model catalog'), required=True) | ||
| cache_dir = forms.TextInputField(_('Model catalog'), required=True) |
There was a problem hiding this comment.
The code snippet you provided contains an error: it attempts to define two fields with the same name (cache_folder and cache_dir) using different class attributes. This will likely result in a runtime exception because Python does not allow duplicate attribute names within the same class.
To fix this, you can either use one of the field names consistently or modify the cache_dir definition to include additional information if needed, such as setting its initial value:
class MyForm(forms.Form):
# ... other fields ...
cache_folder = forms.TextInputField(_('Model catalog'), required=True)
def encryption_dict(self, model: Dict[str, object]):
return modelIf there was no specific intention to have different fields, simply update the existing cache_folder with an appropriate field instance if necessary. If you intended to add new functionality related to directories instead of form caching, ensure that both fields work together appropriately without ambiguity.
fix: Local rearrangement model cannot be added