Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use strict float handling in JSON functions#5265

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
carltongibson merged 7 commits intoencode:masterfromrpkilby:json-unextension
Sep 25, 2017

Conversation

@rpkilby
Copy link
Contributor

Resolve#4918,fix#5235. The important bits that I gathered from the discussion were:

  • DRF should internally encode/decode only strict JSON, since other modules (eg, postgres'sJSONField) may not be compatible with the extended float values (Infinity,NaN). Incompatible values should raise an exception.
  • Users may still want to render/parse extended JSON.

This PR does the following:

  • Adds an internalrest_framework.utils.json module that defaults to strict JSON encoding/decoding.
  • All imports have been changed torest_framework.utils.json, so they obey the stricter behavior.
  • Adds flake8-tidy-imports, which allows us direct users to import the json wrapper module.
  • Addssettings.STRICT_JSON, which controls the strictness ofJSONParser &JSONRenderer. This defaults toTrue, but users can revert to the old extended behavior by setting this toFalse

Nifled reacted with thumbs up emojidashed reacted with eyes emoji
Ryan P Kilby added4 commitsJuly 10, 2017 16:55
STRICT_JSON controls the renderer & parser behavior on whether or notto accept non-standard float values (NaN, Infinity).
@rpkilby
Copy link
ContributorAuthor

@sbchisholm,@andyneff - does this provide the expected behavior?

@@ -0,0 +1,33 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Worth a docstring here to highlight why we have this module.

rpkilby reacted with thumbs up emoji
@lovelydinosaur
Copy link
Contributor

This is ace. Nice work@rpkilby!

@lovelydinosaur
Copy link
Contributor

Looks great. Deferring to 3.7.0.

@carltongibsoncarltongibson merged commitea894cd intoencode:masterSep 25, 2017
@rpkilbyrpkilby deleted the json-unextension branchSeptember 25, 2017 07:15
carltongibson added a commit that referenced this pull requestSep 25, 2017
Strict JSON handling
carltongibson added a commit that referenced this pull requestSep 26, 2017
Strict JSON handling
carltongibson added a commit that referenced this pull requestSep 27, 2017
Strict JSON handling
carltongibson added a commit that referenced this pull requestSep 28, 2017
Strict JSON handling
carltongibson added a commit that referenced this pull requestOct 5, 2017
Strict JSON handling
carltongibson added a commit that referenced this pull requestOct 5, 2017
Strict JSON handling
carltongibson pushed a commit that referenced this pull requestOct 6, 2017
* Set version number for 3.7.0 release* Rename release notes sectionMoved issue links to top for easier access.(Can move back later)* Add release note for#5273* Add release note for#5440* Add release note for#5265Strict JSON handling* Add release note for#5250* Add release notes for#5170* Add release notes for#5443* Add release notes for#5448* Add release notes for#5452* Add release not for#5342* Add release notes for 5454* Add release notes for#5058 &#5457Remove Django 1.8 & 1.9 from README and setup.py* Release notes for merged 3.6.5 milestone ticketsTickets migrated to 3.7.0 milestone.* Add release notes for#5469* Add release notes from AM 2ndOct* Add final changes to the release notes.* Add date and milestone linkMove issue links back to bottom.* Update translations from transifex* Begin releae anouncement* Add release note for#5482* 3.7 release announcement & related docs.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@lovelydinosaurlovelydinosaurlovelydinosaur approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.7.0 Release

Development

Successfully merging this pull request may close these issues.

JSONField: Infinity, -Inifinity, NaN are not compatible with Postgres' JSON field

3 participants

@rpkilby@lovelydinosaur@carltongibson

[8]ページ先頭

©2009-2025 Movatter.jp