Update WasbHook to reflect preference for unprefixed extra#27024
Merged
dstandish merged 4 commits intoapache:mainfrom Oct 22, 2022
Merged
Update WasbHook to reflect preference for unprefixed extra#27024dstandish merged 4 commits intoapache:mainfrom
dstandish merged 4 commits intoapache:mainfrom
Conversation
Since 2.3 we don't need the extra prefix to edit custom fields with UI form. From 2.5 we won't need to use the prefix in the ui form behaviors method either.
| f"when using this method." | ||
| ) | ||
| if field_name in extra_dict: | ||
| return extra_dict[field_name] or None |
Contributor
There was a problem hiding this comment.
Is None needed to be returned when the key is present in the dict? WDYT?
Contributor
Author
There was a problem hiding this comment.
could be empty string
Contributor
Author
There was a problem hiding this comment.
i like to treat empty string as none in this context because UI creates all custom fields with empty string even if not supplied
|
|
||
| def _get_field(self, extra_dict, field_name): | ||
| prefix = 'extra__wasb__' | ||
| if field_name.startswith('extra_'): |
Contributor
There was a problem hiding this comment.
Same as the previous PR review comment, can we check for the exact key extra__
| ) | ||
| if field_name in extra_dict: | ||
| return extra_dict[field_name] or None | ||
| return extra_dict.get(f"{prefix}{field_name}") or None |
Contributor
There was a problem hiding this comment.
we also write like this extra_dict.get(f"{prefix}{field_name}", None) , its upto you
Contributor
Author
There was a problem hiding this comment.
difference is empty string
eladkal
approved these changes
Oct 21, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 2.3 we don't need the extra prefix to edit custom fields with UI form. From 2.5 we won't need to use the prefix in the ui form behaviors method either.