Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork16.7k
Conversation
greyli commentedJul 3, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The failing "Pallets Development Versions" check is due to a missing import in Werkzueg ( |
davidism commentedJul 3, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Looks like that fix should be made in Werkzeug@pgjones |
davidism commentedJul 3, 2022
I think my original hesitation was that returning a dict is explicitly different from returning a database model. Returning a list of database results is probably something a lot more users will try. But I guess it's not that different to say they have to do |
greyli commentedJul 3, 2022
I see. If they don't return a list of objects directly and call jsonify for the list, they will get the same error. Maybe we could update the docs to mention that the ORM/ODM object is not jsonify-able, they need to convert them to a dict or use a serialization library. |
davidism commentedJul 3, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Another potential confusion now that we support returning iterators/generators is that you're going to get very different results doing |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This adds support to serializing list return values to JSON, like what we did for the dictionary:
There are some discusses related to this feature in#3111, and the concern is the list return value looks too much like the tuple. Maybe we can rethink about this feature? I propose this because the following reasons:
[1, 2, 3]and(1, 2, 3), and people usually return tuple items without the bracket in the view function.If this change is acceptable, I will update the docs and changelog.
Sorry for break the "zero status". :P
Checklist:
CHANGES.rstsummarizing the change and linking to the issue... versionchanged::entries in any relevant code docs.pre-commithooks and fix any issues.pytestandtox, no tests failed.