Bug 8866 - Home-brew JSON encoding is ad hoc and incomplete
Summary: Home-brew JSON encoding is ad hoc and incomplete
Status: NEW
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 2.1
Hardware: x86 Multiple
: Medium enhancement
Target Milestone: Future
Assignee: Toaster default assignee
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-01-04 11:48 UTC by Elliot Smith
Modified: 2023-12-14 04:24 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elliot Smith 2016-01-04 11:48:07 UTC
The JSON encoder used to convert querysets to JSON responses is hand-cranked and incomplete. It recently caused an issue where we had a decimal field in a queryset and our encoder didn't know what to do with it, so it failed with a mostly incomprehensible error.

objtojson() in toastergui/views.py is the main offender, closely followed by the code locations which call that function.

Rather than use objtojson() and friends, we should use the Django JSON encoder as far as possible, and maybe even the Django JSON HTTP response classes when encoding the body of a response.