```
Data to be dumped into json. By default only ``dict`` objects
are allowed to be passed due to a security flaw before EcmaScript 5.
See
the ``safe`` parameter for more information.
```
EcmaScript 5 is mostly dead, but there are other advantages to only
sending dicts, see https://twitter.com/simonw/status/1410682522908856320
--
Ticket URL: <https://code.djangoproject.com/ticket/32899>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> currently JSONResponse documents a `safe` kwarg
>
> ```
> Data to be dumped into json. By default only ``dict`` objects
> are allowed to be passed due to a security flaw before EcmaScript
> 5. See
> the ``safe`` parameter for more information.
> ```
>
> EcmaScript 5 is mostly dead, but there are other advantages to only
> sending dicts, see https://twitter.com/simonw/status/1410682522908856320
New description:
currently JSONResponse documents a `safe` kwarg
{{{
Data to be dumped into json. By default only ``dict`` objects
are allowed to be passed due to a security flaw before EcmaScript 5.
See
the ``safe`` parameter for more information.
}}}
EcmaScript 5 is mostly dead, but there are other advantages to only
sending dicts, see https://twitter.com/simonw/status/1410682522908856320
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:1>
* owner: Simon Willison => (none)
* status: assigned => new
* stage: Unreviewed => Accepted
Comment:
Agreed, we can enhance this warning. Thomas, would you like to submit a
patch?
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:2>
* cc: Simon Willison (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:3>
* owner: (none) => Hasan Ramezani
* status: new => assigned
* has_patch: 0 => 1
Comment:
I added a small sentence to mention that object response makes the
expansion of response simpler.
@Mariusz, I think is about the `safe=True kwarg docs` but you mentioned to
`enhance the warning`. which warning do you mean?
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:4>
* needs_better_patch: 0 => 1
Comment:
You've added a note to the docstring, which is fine, but we should also
add a note to the [https://docs.djangoproject.com/en/3.2/ref/request-
response/#serializing-non-dictionary-objects warning] in the docs.
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:5>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:6>
Comment (by Hasan Ramezani):
@Mariusz, I got some reviews on PR. Could you please clarify for me what
should I do? Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:7>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f5669fd7b568cf8a3eda1e65c1c6fb583c7b177d" f5669fd]:
{{{
#!CommitTicketReference repository=""
revision="f5669fd7b568cf8a3eda1e65c1c6fb583c7b177d"
Fixed #32899 -- Added note about avoiding non-dict objects in JsonResponse
docs.
Co-authored-by: Mariusz Felisiak <felisiak...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32899#comment:9>