[Django] #28230: CallableBool is not JSON serializable

12 views
Skip to first unread message

Django

unread,
May 22, 2017, 11:02:46 AM5/22/17
to django-...@googlegroups.com
#28230: CallableBool is not JSON serializable
-----------------------------------------+------------------------
Reporter: vinay karanam | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Passing values derived using user.is_authenticated or user.is_anonymous to
JsonResponse causes it to crash.

Example condition:

`is_member = user.is_authenticated and user.<custom_method>`

If user is authenticated, value of `is_member` depends on the return value
of `custom_method`.
If user is anonymous, `CallableFalse` is passed to `JsonResponse` and
raises `TypeError`.

--
Ticket URL: <https://code.djangoproject.com/ticket/28230>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 22, 2017, 12:46:10 PM5/22/17
to django-...@googlegroups.com
#28230: Allow DjangoJsonEncoder to serialize CallableBool
-------------------------------------+-------------------------------------

Reporter: vinay karanam | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core | Version: 1.11
(Serialization) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* type: Uncategorized => Cleanup/optimization
* has_patch: 0 => 1
* component: Uncategorized => Core (Serialization)
* stage: Unreviewed => Ready for checkin


Comment:

The [https://github.com/django/django/pull/8532 PR] looks good pending a
few cosmetic updates.

--
Ticket URL: <https://code.djangoproject.com/ticket/28230#comment:1>

Django

unread,
May 22, 2017, 9:58:49 PM5/22/17
to django-...@googlegroups.com
#28230: Allow DjangoJsonEncoder to serialize CallableBool
-------------------------------------+-------------------------------------
Reporter: vinay karanam | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core | Version: 1.11
(Serialization) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"d1d08d86baef05db5b37c266ed9142f1c57e6322" d1d08d86]:
{{{
#!CommitTicketReference repository=""
revision="d1d08d86baef05db5b37c266ed9142f1c57e6322"
[1.11.x] Fixed #28230 -- Allowed DjangoJsonEncoder to serialize
CallableBool.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28230#comment:2>

Django

unread,
May 22, 2017, 10:00:25 PM5/22/17
to django-...@googlegroups.com
#28230: Allow DjangoJsonEncoder to serialize CallableBool
-------------------------------------+-------------------------------------
Reporter: vinay karanam | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Core | Version: 1.11
(Serialization) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"5dc6f77423084dd7c99549b1e477ee573802f5a4" 5dc6f77]:
{{{
#!CommitTicketReference repository=""
revision="5dc6f77423084dd7c99549b1e477ee573802f5a4"
Refs #28230 -- Forwardported 1.11.2 release note.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28230#comment:3>

Reply all
Reply to author
Forward
0 new messages