Rename to_dict to populate in FormDefintion to fix bug - #16553
Merged
Conversation
Old method was overriding the method defined in a mixin (with a different signature) that was called from api.forms
Member
Author
|
test failures unrelated |
guerler
approved these changes
Aug 15, 2023
31 tasks
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.
Old method was overriding the method defined in a mixin (with a different signature) that was called from api.forms
For context, see discussion on backend channel:
The model.FormDefinition.to_dict() method (added in 09/2016 in #3118) takes user, value, and security arguments, which overrides the to_dict definition in the Dictifiable mixin, which takes view and value_mapper as arguments. So, if we call the to_dict method on a FormDefinition object passing it the view/value_mapper arguments, an error will be raised. However, we have (at least) 4 places where we call this method on this object: in galaxy.api.forms it's called in the index, show and create methods with the WRONG arguments (view, value_mapper), and in galaxy.api.users with the CORRECT arguments (user, values, security), which is the ONLY place in lib where it's called with those arguments.
Bug discovered via mypy after adding type annotations in #16434.
How to test the changes?
(Select all options that apply)
License