Skip to content
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

fix: REST API treat 'false' as False #5573

Merged
merged 7 commits into from
Jul 5, 2022
Merged

Conversation

eimrek
Copy link
Member

@eimrek eimrek commented Jun 17, 2022

fixes #3635

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this long-standing issue @eimrek !

I'm not familiar with pyparsing - would you mind adding a test that demonstrates your fix solves the issue?

Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

@eimrek thanks! A minor request, probably better to look into how this parsed attribute is used in resource.py::Node.get() method.

aiida/restapi/common/utils.py Show resolved Hide resolved
@eimrek
Copy link
Member Author

eimrek commented Jul 5, 2022

Ok, i added a separate test for lowercase download=false. Although identical to the download=False test, it does capture this bug.

@eimrek eimrek requested review from unkcpz and ltalirz July 5, 2022 17:15
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

@eimrek thanks, one minor request.

tests/restapi/test_routes.py Outdated Show resolved Hide resolved
eimrek and others added 3 commits July 5, 2022 21:20
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

Thanks!

@unkcpz unkcpz merged commit 7772adc into aiidateam:main Jul 5, 2022
sphuber pushed a commit that referenced this pull request Jul 13, 2022
fixes #3635

The parser function that we use to parse the query string doesn't parse booleans as expected.
When passing `false` in URL it will pared as `True` which is not correct.
This PR fixes it by comparing the `true` or `false` attribute in url directly with the string `'true'` and return bool type.

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Cherry-pick: 7772adc
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.

REST API: query string parser fails to parse boolean false
3 participants