Flask v1.1.0 Release Notes
Release Date: 2019-07-09 // almost 5 years ago-
๐ Released 2019-07-04
- Bump minimum Werkzeug version to >= 0.15.
- ๐ Drop support for Python 3.4.
Error handlers for
InternalServerError
or500
will always be passed an instance ofInternalServerError
. If they are invoked due to an unhandled exception, that original exception is now available ase.original_exception
rather than being passed directly to the handler. The same is true if the handler is for the baseHTTPException
. This makes error handler behavior more consistent. :pr:3266
- :meth:
Flask.finalize_request
is called for all unhandled exceptions even if there is no500
error handler.
- :meth:
:attr:
Flask.logger
takes the same name as :attr:Flask.name
(the value passed asFlask(import_name)
. This reverts 1.0's behavior of always logging to"flask.app"
, in order to support multiple apps in the same process. A warning will be shown if old configuration is detected that needs to be moved. :issue:2866
:meth:
flask.RequestContext.copy
includes the current session object in the request context copy. This preventssession
pointing to an out-of-date object. :issue:2935
๐จ Using built-in RequestContext, unprintable Unicode characters in Host header will result in a HTTP 400 response and not HTTP 500 as previously. :pr:
2994
๐ :func:
send_file
supports :class:~os.PathLike
objects as described in PEP 0519, to support :mod:pathlib
in Python 3. :pr:3059
๐ :func:
send_file
supports :class:~io.BytesIO
partial content. :issue:2957
:func:
open_resource
accepts the "rt" file mode. This still does the same thing as "r". :issue:3163
The :attr:
MethodView.methods
attribute set in a base class is used by subclasses. :issue:3138
:attr:
Flask.jinja_options
is adict
instead of anImmutableDict
to allow easier configuration. Changes must still be made before creating the environment. :pr:3190
Flask's
JSONMixin
for the request and response wrappers was moved into Werkzeug. Use Werkzeug's version with Flask-specific support. This bumps the Werkzeug dependency to >= 0.15. :issue:3125
The
flask
command entry point is simplified to take advantage of Werkzeug 0.15's better reloader support. This bumps the Werkzeug dependency to >= 0.15. :issue:3022
Support
static_url_path
that ends with a forward slash. :issue:3134
๐ Support empty
static_folder
without requiring setting an emptystatic_url_path
as well. :pr:3124
๐ :meth:
jsonify
supports :class:dataclasses.dataclass
objects. :pr:3195
Allow customizing the :attr:
Flask.url_map_class
used for routing. :pr:3069
The development server port can be set to 0, which tells the OS to pick an available port. :issue:
2926
The return value from :meth:
cli.load_dotenv
is more consistent with the documentation. It will returnFalse
if python-dotenv is not installed, or if the given path isn't a file. :issue:2937
๐ฆ Signaling support has a stub for the
connect_via
method when the Blinker library is not installed. :pr:3208
Add an
--extra-files
option to theflask run
CLI command to specify extra files that will trigger the reloader on change. :issue:2897
Allow returning a dictionary from a view function. Similar to how returning a string will produce a
text/html
response, returning a dict will calljsonify
to produce aapplication/json
response. :pr:3111
๐จ Blueprints have a
cli
Click group likeapp.cli
. CLI commands registered with a blueprint will be available as a group under theflask
command. :issue:1357
.โ When using the test client as a context manager (
with client:
), all preserved request contexts are popped when the block exits, ensuring nested contexts are cleaned up correctly. :pr:3157
๐ Show a better error message when the view return type is not supported. :issue:
3214
โ
flask.testing.make_test_environ_builder()
has been deprecated in favour of a new classflask.testing.EnvironBuilder
. :pr:3232
The
flask run
command no longer fails if Python is not built with SSL support. Using the--cert
option will show an appropriate error message. :issue:3211
URL matching now occurs after the request context is pushed, rather than when it's created. This allows custom URL converters to access the app and request contexts, such as to query a database for an id. :issue:
3088