Skip to content

Default resolve uses dict key if source value is dict #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

tgriesser
Copy link
Contributor

If the source value is a dict it seemed like this would make sense as the default behavior, and I was actually surprised it wasn't the default. So I figured I'd open it up for discussion, at least to figure out if this was an oversight or if this was intentionally excluded.

property = None
if hasattr(source, name):
property = getattr(source, name)
elif type(source) is dict:

Choose a reason for hiding this comment

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

You may instead want to use isintance(source, dict) in this conditional to support subclasses of dict.

@caseywebdev
Copy link
Contributor

Oh hey @tgriesser 😉

Updated PR at #174

@syrusakbary syrusakbary force-pushed the master branch 3 times, most recently from b1f26c1 to a7ce75e Compare July 19, 2018 18:24
@dan98765
Copy link
Collaborator

Since graphql-python/graphql-core#174 seems to be the same thing, let's close this PR out and focus on fixing and merging that one.

@dan98765 dan98765 closed this Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants