You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Better error message when view return type is not supported #3214
One of the most common errors/questions on Stack Overflow is some variant of "what does 'dict object is not callable' mean, how do I return JSON?" Now that #3111 is merged, returning dict from a view produces a JSON response. However, there are still plenty of other types that will produce that error, such as returning a bool, or a User object, or a list of rows from a database query.
Flask.make_response should check whether an otherwise unhandled value is a BaseResponse subclass or a callable before treating it as such. Then it can raise a more helpful error.
What is the utility of using force_type on Response subclasses then? I had a custom response class that would call special internal serialization on subclasses of my application model objects within force_type. Now force_type never gets called.
Activity
Better error message when view return type is not supported
Better error message when view return type is not supported
Better error message when view return type is not supported
jaos commentedon Jul 8, 2019
What is the utility of using force_type on Response subclasses then? I had a custom response class that would call special internal serialization on subclasses of my application model objects within force_type. Now force_type never gets called.
davidism commentedon Jul 8, 2019
Please open a new issue if you have a new issue. Be sure to include a minimal reproducible example.
jaos commentedon Jul 8, 2019
Thanks, will do.