#28230 closed Cleanup/optimization (fixed)
Allow DjangoJsonEncoder to serialize CallableBool
| Reported by: | vinay karanam | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Serialization) | Version: | 1.11 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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.
Change History (3)
comment:1 by , 8 years ago
| Component: | Uncategorized → Core (Serialization) |
|---|---|
| Has patch: | set |
| Summary: | CallableBool is not JSON serializable → Allow DjangoJsonEncoder to serialize CallableBool |
| Triage Stage: | Unreviewed → Ready for checkin |
| Type: | Uncategorized → Cleanup/optimization |
Note:
See TracTickets
for help on using tickets.
The PR looks good pending a few cosmetic updates.