Fix JSONP issues#212
Closed
dracos wants to merge 2 commits into
Closed
Conversation
If a callback variable was supplied for a view that errors (e.g. no polygons), then this led to a cacheable (200) response which contained a generator function (iterencode) in its _closable_objects attribute. The cache could not then pickle this attribute and so raised an exception. This was okay in previous versions because of a side effect of the smart_bytes workaround for Django bug #24240 that was in place; this was removed when support for Django prior to 1.8 was dropped. Fix the issue by using an identity map (as map has no close() method and so is not added to _closable_objects).
Contributor
|
👍 I think 2a30c9e is as good as the alternative you suggest, since it can be used in all cases (200 or not). |
Don't add callback to non-JSON responses, or to responses that already have a callback (presumably returned from a cache).
decd580 to
42032d3
Compare
Member
Author
|
Merged at 66e8f90 (fixed a comment typo). |
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.
An alternative solution to 2a30c9e would be for non-200 responses, consuming the generator immediately, as it'll always be small. Not sure if that's preferable/clearer.