Add support for the datetime.date type to jsonify, which currently only supports the datetime.datetime type.
Changelog
- datetime.date type support in flask.json.jsonify
Member
datetime is a subclass of date, there's no need to check both. Simply isinstance(o, date) will suffice.
Author
@davidism - thanks! I've reduced it to a single check.
Member
You should add a test for this as well. In addition, the commits can be squashed into one.
Contributor
And please add a changelog too :)
You can squash commits with:
git rebase -i master
But it doesn't really matter if you don't.
@davidism Thanks for reviewing this!
Contributor
why does the "unit-test" involve a flask app and a test client, its just jsonify this time
(i realize the surrounding tests are acceptance tests of request handling)
Author
@untitaker - changelog entry added. sorry - I misunderstood what you were asking for before.
@RonnyPfannschmidt - mainly it's that way because that's how all of other tests are to be set up, but also because jsonify doesn't seem to work outside of an application context. I supposed because it returns an actual response in addition to the serialized data.
Contributor
Woo, thanks!
Your explanation for using a temporary app for testing is sound, although I haven't explored this myself.
github-actions
Bot
locked as resolved and limited conversation to collaborators