CHANGES.rst
This file
Path
CHANGES.rst
1,667 lines · 71.9 KiB
Last changed by
fix linkDavid Lordbefore adoption41cb747
History of this fileTake it
1Version 3.2.02-------------34Unreleased56- Drop support for Python 3.9 and 3.10. :pr:`5730` :pr:`6168`7- Remove previously deprecated code: ``__version__``. :pr:`5648`8- ``RequestContext`` has merged with ``AppContext``. ``RequestContext`` is now9 a deprecated alias. If an app context is already pushed, it is not reused10 when dispatching a request. This greatly simplifies the internal code for11 tracking the active context. :issue:`5639`12- Many ``Flask`` methods involved in request dispatch now take the current13 ``AppContext`` as the first parameter, instead of using the proxy objects.14 If subclasses were overriding these methods, the old signature is detected,15 shows a deprecation warning, and will continue to work during the16 deprecation period. :issue:`5815`17- All teardown callbacks are called, even if any raise an error. :pr:`5928`18- The ``should_ignore_error`` is deprecated. Handle errors as needed in19 teardown handlers instead. :issue:`5816`20- ``template_filter``, ``template_test``, and ``template_global`` decorators21 can be used without parentheses. :issue:`5729`22- ``redirect`` returns a ``303`` status code by default instead of ``302``.23 This tells the client to always switch to ``GET``, rather than only24 switching ``POST`` to ``GET``. This preserves the current behavior of25 ``GET`` and ``POST`` redirects, and is also correct for frontend libraries26 such as HTMX. :issue:`5895`27- ``provide_automatic_options=True`` can be used to enable it for a view when28 it's disabled in config. Previously, only disabling worked. :issue:`5916`29- ``Flask.select_jinja_autoescape`` uses case-insensitive comparison instead30 of only lower case file extensions. :pr:`6012`31- Fix parsing IPv6 with port in ``run`` and the test client. :pr:`6096`32- Add ``app.query`` route decorator for the HTTP QUERY method.333435Version 3.1.336-------------3738Released 2026-02-183940- The session is marked as accessed for operations that only access the keys41 but not the values, such as ``in`` and ``len``. :ghsa:`68rp-wp8r-4726`424344Version 3.1.245-------------4647Released 2025-08-194849- ``stream_with_context`` does not fail inside async views. :issue:`5774`50- When using ``follow_redirects`` in the test client, the final state51 of ``session`` is correct. :issue:`5786`52- Relax type hint for passing bytes IO to ``send_file``. :issue:`5776`535455Version 3.1.156-------------5758Released 2025-05-135960- Fix signing key selection order when key rotation is enabled via61 ``SECRET_KEY_FALLBACKS``. :ghsa:`4grg-w6v8-c28g`62- Fix type hint for ``cli_runner.invoke``. :issue:`5645`63- ``flask --help`` loads the app and plugins first to make sure all commands64 are shown. :issue:`5673`65- Mark sans-io base class as being able to handle views that return66 ``AsyncIterable``. This is not accurate for Flask, but makes typing easier67 for Quart. :pr:`5659`686970Version 3.1.071-------------7273Released 2024-11-137475- Drop support for Python 3.8. :pr:`5623`76- Update minimum dependency versions to latest feature releases.77 Werkzeug >= 3.1, ItsDangerous >= 2.2, Blinker >= 1.9. :pr:`5624,5633`78- Provide a configuration option to control automatic option79 responses. :pr:`5496`80- ``Flask.open_resource``/``open_instance_resource`` and81 ``Blueprint.open_resource`` take an ``encoding`` parameter to use when82 opening in text mode. It defaults to ``utf-8``. :issue:`5504`83- ``Request.max_content_length`` can be customized per-request instead of only84 through the ``MAX_CONTENT_LENGTH`` config. Added85 ``MAX_FORM_MEMORY_SIZE`` and ``MAX_FORM_PARTS`` config. Added documentation86 about resource limits to the security page. :issue:`5625`87- Add support for the ``Partitioned`` cookie attribute (CHIPS), with the88 ``SESSION_COOKIE_PARTITIONED`` config. :issue:`5472`89- ``-e path`` takes precedence over default ``.env`` and ``.flaskenv`` files.90 ``load_dotenv`` loads default files in addition to a path unless91 ``load_defaults=False`` is passed. :issue:`5628`92- Support key rotation with the ``SECRET_KEY_FALLBACKS`` config, a list of old93 secret keys that can still be used for unsigning. Extensions will need to94 add support. :issue:`5621`95- Fix how setting ``host_matching=True`` or ``subdomain_matching=False``96 interacts with ``SERVER_NAME``. Setting ``SERVER_NAME`` no longer restricts97 requests to only that domain. :issue:`5553`98- ``Request.trusted_hosts`` is checked during routing, and can be set through99 the ``TRUSTED_HOSTS`` config. :issue:`5636`100101102Version 3.0.3103-------------104105Released 2024-04-07106107- The default ``hashlib.sha1`` may not be available in FIPS builds. Don't108 access it at import time so the developer has time to change the default.109 :issue:`5448`110- Don't initialize the ``cli`` attribute in the sansio scaffold, but rather in111 the ``Flask`` concrete class. :pr:`5270`112113114Version 3.0.2115-------------116117Released 2024-02-03118119- Correct type for ``jinja_loader`` property. :issue:`5388`120- Fix error with ``--extra-files`` and ``--exclude-patterns`` CLI options.121 :issue:`5391`122123124Version 3.0.1125-------------126127Released 2024-01-18128129- Correct type for ``path`` argument to ``send_file``. :issue:`5336`130- Fix a typo in an error message for the ``flask run --key`` option. :pr:`5344`131- Session data is untagged without relying on the built-in ``json.loads``132 ``object_hook``. This allows other JSON providers that don't implement that.133 :issue:`5381`134- Address more type findings when using mypy strict mode. :pr:`5383`135136137Version 3.0.0138-------------139140Released 2023-09-30141142- Remove previously deprecated code. :pr:`5223`143- Deprecate the ``__version__`` attribute. Use feature detection, or144 ``importlib.metadata.version("flask")``, instead. :issue:`5230`145- Restructure the code such that the Flask (app) and Blueprint146 classes have Sans-IO bases. :pr:`5127`147- Allow self as an argument to url_for. :pr:`5264`148- Require Werkzeug >= 3.0.0.149150151Version 2.3.3152-------------153154Released 2023-08-21155156- Python 3.12 compatibility.157- Require Werkzeug >= 2.3.7.158- Use ``flit_core`` instead of ``setuptools`` as build backend.159- Refactor how an app's root and instance paths are determined. :issue:`5160`160161162Version 2.3.2163-------------164165Released 2023-05-01166167- Set ``Vary: Cookie`` header when the session is accessed, modified, or refreshed.168- Update Werkzeug requirement to >=2.3.3 to apply recent bug fixes.169 :ghsa:`m2qf-hxjv-5gpq`170171172Version 2.3.1173-------------174175Released 2023-04-25176177- Restore deprecated ``from flask import Markup``. :issue:`5084`178179180Version 2.3.0181-------------182183Released 2023-04-25184185- Drop support for Python 3.7. :pr:`5072`186- Update minimum requirements to the latest versions: Werkzeug>=2.3.0, Jinja2>3.1.2,187 itsdangerous>=2.1.2, click>=8.1.3.188- Remove previously deprecated code. :pr:`4995`189190 - The ``push`` and ``pop`` methods of the deprecated ``_app_ctx_stack`` and191 ``_request_ctx_stack`` objects are removed. ``top`` still exists to give192 extensions more time to update, but it will be removed.193 - The ``FLASK_ENV`` environment variable, ``ENV`` config key, and ``app.env``194 property are removed.195 - The ``session_cookie_name``, ``send_file_max_age_default``, ``use_x_sendfile``,196 ``propagate_exceptions``, and ``templates_auto_reload`` properties on ``app``197 are removed.198 - The ``JSON_AS_ASCII``, ``JSON_SORT_KEYS``, ``JSONIFY_MIMETYPE``, and199 ``JSONIFY_PRETTYPRINT_REGULAR`` config keys are removed.200 - The ``app.before_first_request`` and ``bp.before_app_first_request`` decorators201 are removed.202 - ``json_encoder`` and ``json_decoder`` attributes on app and blueprint, and the203 corresponding ``json.JSONEncoder`` and ``JSONDecoder`` classes, are removed.204 - The ``json.htmlsafe_dumps`` and ``htmlsafe_dump`` functions are removed.205 - Calling setup methods on blueprints after registration is an error instead of a206 warning. :pr:`4997`207208- Importing ``escape`` and ``Markup`` from ``flask`` is deprecated. Import them209 directly from ``markupsafe`` instead. :pr:`4996`210- The ``app.got_first_request`` property is deprecated. :pr:`4997`211- The ``locked_cached_property`` decorator is deprecated. Use a lock inside the212 decorated function if locking is needed. :issue:`4993`213- Signals are always available. ``blinker>=1.6.2`` is a required dependency. The214 ``signals_available`` attribute is deprecated. :issue:`5056`215- Signals support ``async`` subscriber functions. :pr:`5049`216- Remove uses of locks that could cause requests to block each other very briefly.217 :issue:`4993`218- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.219 :pr:`4947`220- Ensure subdomains are applied with nested blueprints. :issue:`4834`221- ``config.from_file`` can use ``text=False`` to indicate that the parser wants a222 binary file instead. :issue:`4989`223- If a blueprint is created with an empty name it raises a ``ValueError``.224 :issue:`5010`225- ``SESSION_COOKIE_DOMAIN`` does not fall back to ``SERVER_NAME``. The default is not226 to set the domain, which modern browsers interpret as an exact match rather than227 a subdomain match. Warnings about ``localhost`` and IP addresses are also removed.228 :issue:`5051`229- The ``routes`` command shows each rule's ``subdomain`` or ``host`` when domain230 matching is in use. :issue:`5004`231- Use postponed evaluation of annotations. :pr:`5071`232233234Version 2.2.5235-------------236237Released 2023-05-02238239- Update for compatibility with Werkzeug 2.3.3.240- Set ``Vary: Cookie`` header when the session is accessed, modified, or refreshed.241242243Version 2.2.4244-------------245246Released 2023-04-25247248- Update for compatibility with Werkzeug 2.3.249250251Version 2.2.3252-------------253254Released 2023-02-15255256- Autoescape is enabled by default for ``.svg`` template files. :issue:`4831`257- Fix the type of ``template_folder`` to accept ``pathlib.Path``. :issue:`4892`258- Add ``--debug`` option to the ``flask run`` command. :issue:`4777`259260261Version 2.2.2262-------------263264Released 2022-08-08265266- Update Werkzeug dependency to >= 2.2.2. This includes fixes related267 to the new faster router, header parsing, and the development268 server. :pr:`4754`269- Fix the default value for ``app.env`` to be ``"production"``. This270 attribute remains deprecated. :issue:`4740`271272273Version 2.2.1274-------------275276Released 2022-08-03277278- Setting or accessing ``json_encoder`` or ``json_decoder`` raises a279 deprecation warning. :issue:`4732`280281282Version 2.2.0283-------------284285Released 2022-08-01286287- Remove previously deprecated code. :pr:`4667`288289 - Old names for some ``send_file`` parameters have been removed.290 ``download_name`` replaces ``attachment_filename``, ``max_age``291 replaces ``cache_timeout``, and ``etag`` replaces ``add_etags``.292 Additionally, ``path`` replaces ``filename`` in293 ``send_from_directory``.294 - The ``RequestContext.g`` property returning ``AppContext.g`` is295 removed.296297- Update Werkzeug dependency to >= 2.2.298- The app and request contexts are managed using Python context vars299 directly rather than Werkzeug's ``LocalStack``. This should result300 in better performance and memory use. :pr:`4682`301302 - Extension maintainers, be aware that ``_app_ctx_stack.top``303 and ``_request_ctx_stack.top`` are deprecated. Store data on304 ``g`` instead using a unique prefix, like305 ``g._extension_name_attr``.306307- The ``FLASK_ENV`` environment variable and ``app.env`` attribute are308 deprecated, removing the distinction between development and debug309 mode. Debug mode should be controlled directly using the ``--debug``310 option or ``app.run(debug=True)``. :issue:`4714`311- Some attributes that proxied config keys on ``app`` are deprecated:312 ``session_cookie_name``, ``send_file_max_age_default``,313 ``use_x_sendfile``, ``propagate_exceptions``, and314 ``templates_auto_reload``. Use the relevant config keys instead.315 :issue:`4716`316- Add new customization points to the ``Flask`` app object for many317 previously global behaviors.318319 - ``flask.url_for`` will call ``app.url_for``. :issue:`4568`320 - ``flask.abort`` will call ``app.aborter``.321 ``Flask.aborter_class`` and ``Flask.make_aborter`` can be used322 to customize this aborter. :issue:`4567`323 - ``flask.redirect`` will call ``app.redirect``. :issue:`4569`324 - ``flask.json`` is an instance of ``JSONProvider``. A different325 provider can be set to use a different JSON library.326 ``flask.jsonify`` will call ``app.json.response``, other327 functions in ``flask.json`` will call corresponding functions in328 ``app.json``. :pr:`4692`329330- JSON configuration is moved to attributes on the default331 ``app.json`` provider. ``JSON_AS_ASCII``, ``JSON_SORT_KEYS``,332 ``JSONIFY_MIMETYPE``, and ``JSONIFY_PRETTYPRINT_REGULAR`` are333 deprecated. :pr:`4692`334- Setting custom ``json_encoder`` and ``json_decoder`` classes on the335 app or a blueprint, and the corresponding ``json.JSONEncoder`` and336 ``JSONDecoder`` classes, are deprecated. JSON behavior can now be337 overridden using the ``app.json`` provider interface. :pr:`4692`338- ``json.htmlsafe_dumps`` and ``json.htmlsafe_dump`` are deprecated,339 the function is built-in to Jinja now. :pr:`4692`340- Refactor ``register_error_handler`` to consolidate error checking.341 Rewrite some error messages to be more consistent. :issue:`4559`342- Use Blueprint decorators and functions intended for setup after343 registering the blueprint will show a warning. In the next version,344 this will become an error just like the application setup methods.345 :issue:`4571`346- ``before_first_request`` is deprecated. Run setup code when creating347 the application instead. :issue:`4605`348- Added the ``View.init_every_request`` class attribute. If a view349 subclass sets this to ``False``, the view will not create a new350 instance on every request. :issue:`2520`.351- A ``flask.cli.FlaskGroup`` Click group can be nested as a352 sub-command in a custom CLI. :issue:`3263`353- Add ``--app`` and ``--debug`` options to the ``flask`` CLI, instead354 of requiring that they are set through environment variables.355 :issue:`2836`356- Add ``--env-file`` option to the ``flask`` CLI. This allows357 specifying a dotenv file to load in addition to ``.env`` and358 ``.flaskenv``. :issue:`3108`359- It is no longer required to decorate custom CLI commands on360 ``app.cli`` or ``blueprint.cli`` with ``@with_appcontext``, an app361 context will already be active at that point. :issue:`2410`362- ``SessionInterface.get_expiration_time`` uses a timezone-aware363 value. :pr:`4645`364- View functions can return generators directly instead of wrapping365 them in a ``Response``. :pr:`4629`366- Add ``stream_template`` and ``stream_template_string`` functions to367 render a template as a stream of pieces. :pr:`4629`368- A new implementation of context preservation during debugging and369 testing. :pr:`4666`370371 - ``request``, ``g``, and other context-locals point to the372 correct data when running code in the interactive debugger373 console. :issue:`2836`374 - Teardown functions are always run at the end of the request,375 even if the context is preserved. They are also run after the376 preserved context is popped.377 - ``stream_with_context`` preserves context separately from a378 ``with client`` block. It will be cleaned up when379 ``response.get_data()`` or ``response.close()`` is called.380381- Allow returning a list from a view function, to convert it to a382 JSON response like a dict is. :issue:`4672`383- When type checking, allow ``TypedDict`` to be returned from view384 functions. :pr:`4695`385- Remove the ``--eager-loading/--lazy-loading`` options from the386 ``flask run`` command. The app is always eager loaded the first387 time, then lazily loaded in the reloader. The reloader always prints388 errors immediately but continues serving. Remove the internal389 ``DispatchingApp`` middleware used by the previous implementation.390 :issue:`4715`391392393Version 2.1.3394-------------395396Released 2022-07-13397398- Inline some optional imports that are only used for certain CLI399 commands. :pr:`4606`400- Relax type annotation for ``after_request`` functions. :issue:`4600`401- ``instance_path`` for namespace packages uses the path closest to402 the imported submodule. :issue:`4610`403- Clearer error message when ``render_template`` and404 ``render_template_string`` are used outside an application context.405 :pr:`4693`406407408Version 2.1.2409-------------410411Released 2022-04-28412413- Fix type annotation for ``json.loads``, it accepts str or bytes.414 :issue:`4519`415- The ``--cert`` and ``--key`` options on ``flask run`` can be given416 in either order. :issue:`4459`417418419Version 2.1.1420-------------421422Released on 2022-03-30423424- Set the minimum required version of importlib_metadata to 3.6.0,425 which is required on Python < 3.10. :issue:`4502`426427428Version 2.1.0429-------------430431Released 2022-03-28432433- Drop support for Python 3.6. :pr:`4335`434- Update Click dependency to >= 8.0. :pr:`4008`435- Remove previously deprecated code. :pr:`4337`436437 - The CLI does not pass ``script_info`` to app factory functions.438 - ``config.from_json`` is replaced by439 ``config.from_file(name, load=json.load)``.440 - ``json`` functions no longer take an ``encoding`` parameter.441 - ``safe_join`` is removed, use ``werkzeug.utils.safe_join``442 instead.443 - ``total_seconds`` is removed, use ``timedelta.total_seconds``444 instead.445 - The same blueprint cannot be registered with the same name. Use446 ``name=`` when registering to specify a unique name.447 - The test client's ``as_tuple`` parameter is removed. Use448 ``response.request.environ`` instead. :pr:`4417`449450- Some parameters in ``send_file`` and ``send_from_directory`` were451 renamed in 2.0. The deprecation period for the old names is extended452 to 2.2. Be sure to test with deprecation warnings visible.453454 - ``attachment_filename`` is renamed to ``download_name``.455 - ``cache_timeout`` is renamed to ``max_age``.456 - ``add_etags`` is renamed to ``etag``.457 - ``filename`` is renamed to ``path``.458459- The ``RequestContext.g`` property is deprecated. Use ``g`` directly460 or ``AppContext.g`` instead. :issue:`3898`461- ``copy_current_request_context`` can decorate async functions.462 :pr:`4303`463- The CLI uses ``importlib.metadata`` instead of ``pkg_resources`` to464 load command entry points. :issue:`4419`465- Overriding ``FlaskClient.open`` will not cause an error on redirect.466 :issue:`3396`467- Add an ``--exclude-patterns`` option to the ``flask run`` CLI468 command to specify patterns that will be ignored by the reloader.469 :issue:`4188`470- When using lazy loading (the default with the debugger), the Click471 context from the ``flask run`` command remains available in the472 loader thread. :issue:`4460`473- Deleting the session cookie uses the ``httponly`` flag.474 :issue:`4485`475- Relax typing for ``errorhandler`` to allow the user to use more476 precise types and decorate the same function multiple times.477 :issue:`4095, 4295, 4297`478- Fix typing for ``__exit__`` methods for better compatibility with479 ``ExitStack``. :issue:`4474`480- From Werkzeug, for redirect responses the ``Location`` header URL481 will remain relative, and exclude the scheme and domain, by default.482 :pr:`4496`483- Add ``Config.from_prefixed_env()`` to load config values from484 environment variables that start with ``FLASK_`` or another prefix.485 This parses values as JSON by default, and allows setting keys in486 nested dicts. :pr:`4479`487488489Version 2.0.3490-------------491492Released 2022-02-14493494- The test client's ``as_tuple`` parameter is deprecated and will be495 removed in Werkzeug 2.1. It is now also deprecated in Flask, to be496 removed in Flask 2.1, while remaining compatible with both in497 2.0.x. Use ``response.request.environ`` instead. :pr:`4341`498- Fix type annotation for ``errorhandler`` decorator. :issue:`4295`499- Revert a change to the CLI that caused it to hide ``ImportError``500 tracebacks when importing the application. :issue:`4307`501- ``app.json_encoder`` and ``json_decoder`` are only passed to502 ``dumps`` and ``loads`` if they have custom behavior. This improves503 performance, mainly on PyPy. :issue:`4349`504- Clearer error message when ``after_this_request`` is used outside a505 request context. :issue:`4333`506507508Version 2.0.2509-------------510511Released 2021-10-04512513- Fix type annotation for ``teardown_*`` methods. :issue:`4093`514- Fix type annotation for ``before_request`` and ``before_app_request``515 decorators. :issue:`4104`516- Fixed the issue where typing requires template global517 decorators to accept functions with no arguments. :issue:`4098`518- Support View and MethodView instances with async handlers. :issue:`4112`519- Enhance typing of ``app.errorhandler`` decorator. :issue:`4095`520- Fix registering a blueprint twice with differing names. :issue:`4124`521- Fix the type of ``static_folder`` to accept ``pathlib.Path``.522 :issue:`4150`523- ``jsonify`` handles ``decimal.Decimal`` by encoding to ``str``.524 :issue:`4157`525- Correctly handle raising deferred errors in CLI lazy loading.526 :issue:`4096`527- The CLI loader handles ``**kwargs`` in a ``create_app`` function.528 :issue:`4170`529- Fix the order of ``before_request`` and other callbacks that trigger530 before the view returns. They are called from the app down to the531 closest nested blueprint. :issue:`4229`532533534Version 2.0.1535-------------536537Released 2021-05-21538539- Re-add the ``filename`` parameter in ``send_from_directory``. The540 ``filename`` parameter has been renamed to ``path``, the old name541 is deprecated. :pr:`4019`542- Mark top-level names as exported so type checking understands543 imports in user projects. :issue:`4024`544- Fix type annotation for ``g`` and inform mypy that it is a namespace545 object that has arbitrary attributes. :issue:`4020`546- Fix some types that weren't available in Python 3.6.0. :issue:`4040`547- Improve typing for ``send_file``, ``send_from_directory``, and548 ``get_send_file_max_age``. :issue:`4044`, :pr:`4026`549- Show an error when a blueprint name contains a dot. The ``.`` has550 special meaning, it is used to separate (nested) blueprint names and551 the endpoint name. :issue:`4041`552- Combine URL prefixes when nesting blueprints that were created with553 a ``url_prefix`` value. :issue:`4037`554- Revert a change to the order that URL matching was done. The555 URL is again matched after the session is loaded, so the session is556 available in custom URL converters. :issue:`4053`557- Re-add deprecated ``Config.from_json``, which was accidentally558 removed early. :issue:`4078`559- Improve typing for some functions using ``Callable`` in their type560 signatures, focusing on decorator factories. :issue:`4060`561- Nested blueprints are registered with their dotted name. This allows562 different blueprints with the same name to be nested at different563 locations. :issue:`4069`564- ``register_blueprint`` takes a ``name`` option to change the565 (pre-dotted) name the blueprint is registered with. This allows the566 same blueprint to be registered multiple times with unique names for567 ``url_for``. Registering the same blueprint with the same name568 multiple times is deprecated. :issue:`1091`569- Improve typing for ``stream_with_context``. :issue:`4052`570571572Version 2.0.0573-------------574575Released 2021-05-11576577- Drop support for Python 2 and 3.5.578- Bump minimum versions of other Pallets projects: Werkzeug >= 2,579 Jinja2 >= 3, MarkupSafe >= 2, ItsDangerous >= 2, Click >= 8. Be sure580 to check the change logs for each project. For better compatibility581 with other applications (e.g. Celery) that still require Click 7,582 there is no hard dependency on Click 8 yet, but using Click 7 will583 trigger a DeprecationWarning and Flask 2.1 will depend on Click 8.584- JSON support no longer uses simplejson. To use another JSON module,585 override ``app.json_encoder`` and ``json_decoder``. :issue:`3555`586- The ``encoding`` option to JSON functions is deprecated. :pr:`3562`587- Passing ``script_info`` to app factory functions is deprecated. This588 was not portable outside the ``flask`` command. Use589 ``click.get_current_context().obj`` if it's needed. :issue:`3552`590- The CLI shows better error messages when the app failed to load591 when looking up commands. :issue:`2741`592- Add ``SessionInterface.get_cookie_name`` to allow setting the593 session cookie name dynamically. :pr:`3369`594- Add ``Config.from_file`` to load config using arbitrary file595 loaders, such as ``toml.load`` or ``json.load``.596 ``Config.from_json`` is deprecated in favor of this. :pr:`3398`597- The ``flask run`` command will only defer errors on reload. Errors598 present during the initial call will cause the server to exit with599 the traceback immediately. :issue:`3431`600- ``send_file`` raises a ``ValueError`` when passed an ``io`` object601 in text mode. Previously, it would respond with 200 OK and an empty602 file. :issue:`3358`603- When using ad-hoc certificates, check for the cryptography library604 instead of PyOpenSSL. :pr:`3492`605- When specifying a factory function with ``FLASK_APP``, keyword606 argument can be passed. :issue:`3553`607- When loading a ``.env`` or ``.flaskenv`` file, the current working608 directory is no longer changed to the location of the file.609 :pr:`3560`610- When returning a ``(response, headers)`` tuple from a view, the611 headers replace rather than extend existing headers on the response.612 For example, this allows setting the ``Content-Type`` for613 ``jsonify()``. Use ``response.headers.extend()`` if extending is614 desired. :issue:`3628`615- The ``Scaffold`` class provides a common API for the ``Flask`` and616 ``Blueprint`` classes. ``Blueprint`` information is stored in617 attributes just like ``Flask``, rather than opaque lambda functions.618 This is intended to improve consistency and maintainability.619 :issue:`3215`620- Include ``samesite`` and ``secure`` options when removing the621 session cookie. :pr:`3726`622- Support passing a ``pathlib.Path`` to ``static_folder``. :pr:`3579`623- ``send_file`` and ``send_from_directory`` are wrappers around the624 implementations in ``werkzeug.utils``. :pr:`3828`625- Some ``send_file`` parameters have been renamed, the old names are626 deprecated. ``attachment_filename`` is renamed to ``download_name``.627 ``cache_timeout`` is renamed to ``max_age``. ``add_etags`` is628 renamed to ``etag``. :pr:`3828, 3883`629- ``send_file`` passes ``download_name`` even if630 ``as_attachment=False`` by using ``Content-Disposition: inline``.631 :pr:`3828`632- ``send_file`` sets ``conditional=True`` and ``max_age=None`` by633 default. ``Cache-Control`` is set to ``no-cache`` if ``max_age`` is634 not set, otherwise ``public``. This tells browsers to validate635 conditional requests instead of using a timed cache. :pr:`3828`636- ``helpers.safe_join`` is deprecated. Use637 ``werkzeug.utils.safe_join`` instead. :pr:`3828`638- The request context does route matching before opening the session.639 This could allow a session interface to change behavior based on640 ``request.endpoint``. :issue:`3776`641- Use Jinja's implementation of the ``|tojson`` filter. :issue:`3881`642- Add route decorators for common HTTP methods. For example,643 ``@app.post("/login")`` is a shortcut for644 ``@app.route("/login", methods=["POST"])``. :pr:`3907`645- Support async views, error handlers, before and after request, and646 teardown functions. :pr:`3412`647- Support nesting blueprints. :issue:`593, 1548`, :pr:`3923`648- Set the default encoding to "UTF-8" when loading ``.env`` and649 ``.flaskenv`` files to allow to use non-ASCII characters. :issue:`3931`650- ``flask shell`` sets up tab and history completion like the default651 ``python`` shell if ``readline`` is installed. :issue:`3941`652- ``helpers.total_seconds()`` is deprecated. Use653 ``timedelta.total_seconds()`` instead. :pr:`3962`654- Add type hinting. :pr:`3973`.655656657Version 1.1.4658-------------659660Released 2021-05-13661662- Update ``static_folder`` to use ``_compat.fspath`` instead of663 ``os.fspath`` to continue supporting Python < 3.6 :issue:`4050`664665666Version 1.1.3667-------------668669Released 2021-05-13670671- Set maximum versions of Werkzeug, Jinja, Click, and ItsDangerous.672 :issue:`4043`673- Re-add support for passing a ``pathlib.Path`` for ``static_folder``.674 :pr:`3579`675676677Version 1.1.2678-------------679680Released 2020-04-03681682- Work around an issue when running the ``flask`` command with an683 external debugger on Windows. :issue:`3297`684- The static route will not catch all URLs if the ``Flask``685 ``static_folder`` argument ends with a slash. :issue:`3452`686687688Version 1.1.1689-------------690691Released 2019-07-08692693- The ``flask.json_available`` flag was added back for compatibility694 with some extensions. It will raise a deprecation warning when used,695 and will be removed in version 2.0.0. :issue:`3288`696697698Version 1.1.0699-------------700701Released 2019-07-04702703- Bump minimum Werkzeug version to >= 0.15.704- Drop support for Python 3.4.705- Error handlers for ``InternalServerError`` or ``500`` will always be706 passed an instance of ``InternalServerError``. If they are invoked707 due to an unhandled exception, that original exception is now708 available as ``e.original_exception`` rather than being passed709 directly to the handler. The same is true if the handler is for the710 base ``HTTPException``. This makes error handler behavior more711 consistent. :pr:`3266`712713 - ``Flask.finalize_request`` is called for all unhandled714 exceptions even if there is no ``500`` error handler.715716- ``Flask.logger`` takes the same name as ``Flask.name`` (the value717 passed as ``Flask(import_name)``. This reverts 1.0's behavior of718 always logging to ``"flask.app"``, in order to support multiple apps719 in the same process. A warning will be shown if old configuration is720 detected that needs to be moved. :issue:`2866`721- ``RequestContext.copy`` includes the current session object in the722 request context copy. This prevents ``session`` pointing to an723 out-of-date object. :issue:`2935`724- Using built-in RequestContext, unprintable Unicode characters in725 Host header will result in a HTTP 400 response and not HTTP 500 as726 previously. :pr:`2994`727- ``send_file`` supports ``PathLike`` objects as described in728 :pep:`519`, to support ``pathlib`` in Python 3. :pr:`3059`729- ``send_file`` supports ``BytesIO`` partial content.730 :issue:`2957`731- ``open_resource`` accepts the "rt" file mode. This still does the732 same thing as "r". :issue:`3163`733- The ``MethodView.methods`` attribute set in a base class is used by734 subclasses. :issue:`3138`735- ``Flask.jinja_options`` is a ``dict`` instead of an736 ``ImmutableDict`` to allow easier configuration. Changes must still737 be made before creating the environment. :pr:`3190`738- Flask's ``JSONMixin`` for the request and response wrappers was739 moved into Werkzeug. Use Werkzeug's version with Flask-specific740 support. This bumps the Werkzeug dependency to >= 0.15.741 :issue:`3125`742- The ``flask`` command entry point is simplified to take advantage743 of Werkzeug 0.15's better reloader support. This bumps the Werkzeug744 dependency to >= 0.15. :issue:`3022`745- Support ``static_url_path`` that ends with a forward slash.746 :issue:`3134`747- Support empty ``static_folder`` without requiring setting an empty748 ``static_url_path`` as well. :pr:`3124`749- ``jsonify`` supports ``dataclass`` objects. :pr:`3195`750- Allow customizing the ``Flask.url_map_class`` used for routing.751 :pr:`3069`752- The development server port can be set to 0, which tells the OS to753 pick an available port. :issue:`2926`754- The return value from ``cli.load_dotenv`` is more consistent with755 the documentation. It will return ``False`` if python-dotenv is not756 installed, or if the given path isn't a file. :issue:`2937`757- Signaling support has a stub for the ``connect_via`` method when758 the Blinker library is not installed. :pr:`3208`759- Add an ``--extra-files`` option to the ``flask run`` CLI command to760 specify extra files that will trigger the reloader on change.761 :issue:`2897`762- Allow returning a dictionary from a view function. Similar to how763 returning a string will produce a ``text/html`` response, returning764 a dict will call ``jsonify`` to produce a ``application/json``765 response. :pr:`3111`766- Blueprints have a ``cli`` Click group like ``app.cli``. CLI commands767 registered with a blueprint will be available as a group under the768 ``flask`` command. :issue:`1357`.769- When using the test client as a context manager (``with client:``),770 all preserved request contexts are popped when the block exits,771 ensuring nested contexts are cleaned up correctly. :pr:`3157`772- Show a better error message when the view return type is not773 supported. :issue:`3214`774- ``flask.testing.make_test_environ_builder()`` has been deprecated in775 favour of a new class ``flask.testing.EnvironBuilder``. :pr:`3232`776- The ``flask run`` command no longer fails if Python is not built777 with SSL support. Using the ``--cert`` option will show an778 appropriate error message. :issue:`3211`779- URL matching now occurs after the request context is pushed, rather780 than when it's created. This allows custom URL converters to access781 the app and request contexts, such as to query a database for an id.782 :issue:`3088`783784785Version 1.0.4786-------------787788Released 2019-07-04789790- The key information for ``BadRequestKeyError`` is no longer cleared791 outside debug mode, so error handlers can still access it. This792 requires upgrading to Werkzeug 0.15.5. :issue:`3249`793- ``send_file`` url quotes the ":" and "/" characters for more794 compatible UTF-8 filename support in some browsers. :issue:`3074`795- Fixes for :pep:`451` import loaders and pytest 5.x. :issue:`3275`796- Show message about dotenv on stderr instead of stdout. :issue:`3285`797798799Version 1.0.3800-------------801802Released 2019-05-17803804- ``send_file`` encodes filenames as ASCII instead of Latin-1805 (ISO-8859-1). This fixes compatibility with Gunicorn, which is806 stricter about header encodings than :pep:`3333`. :issue:`2766`807- Allow custom CLIs using ``FlaskGroup`` to set the debug flag without808 it always being overwritten based on environment variables.809 :pr:`2765`810- ``flask --version`` outputs Werkzeug's version and simplifies the811 Python version. :pr:`2825`812- ``send_file`` handles an ``attachment_filename`` that is a native813 Python 2 string (bytes) with UTF-8 coded bytes. :issue:`2933`814- A catch-all error handler registered for ``HTTPException`` will not815 handle ``RoutingException``, which is used internally during816 routing. This fixes the unexpected behavior that had been introduced817 in 1.0. :pr:`2986`818- Passing the ``json`` argument to ``app.test_client`` does not819 push/pop an extra app context. :issue:`2900`820821822Version 1.0.2823-------------824825Released 2018-05-02826827- Fix more backwards compatibility issues with merging slashes between828 a blueprint prefix and route. :pr:`2748`829- Fix error with ``flask routes`` command when there are no routes.830 :issue:`2751`831832833Version 1.0.1834-------------835836Released 2018-04-29837838- Fix registering partials (with no ``__name__``) as view functions.839 :pr:`2730`840- Don't treat lists returned from view functions the same as tuples.841 Only tuples are interpreted as response data. :issue:`2736`842- Extra slashes between a blueprint's ``url_prefix`` and a route URL843 are merged. This fixes some backwards compatibility issues with the844 change in 1.0. :issue:`2731`, :issue:`2742`845- Only trap ``BadRequestKeyError`` errors in debug mode, not all846 ``BadRequest`` errors. This allows ``abort(400)`` to continue847 working as expected. :issue:`2735`848- The ``FLASK_SKIP_DOTENV`` environment variable can be set to ``1``849 to skip automatically loading dotenv files. :issue:`2722`850851852Version 1.0853-----------854855Released 2018-04-26856857- Python 2.6 and 3.3 are no longer supported.858- Bump minimum dependency versions to the latest stable versions:859 Werkzeug >= 0.14, Jinja >= 2.10, itsdangerous >= 0.24, Click >= 5.1.860 :issue:`2586`861- Skip ``app.run`` when a Flask application is run from the command862 line. This avoids some behavior that was confusing to debug.863- Change the default for ``JSONIFY_PRETTYPRINT_REGULAR`` to864 ``False``. ``~json.jsonify`` returns a compact format by default,865 and an indented format in debug mode. :pr:`2193`866- ``Flask.__init__`` accepts the ``host_matching`` argument and sets867 it on ``Flask.url_map``. :issue:`1559`868- ``Flask.__init__`` accepts the ``static_host`` argument and passes869 it as the ``host`` argument when defining the static route.870 :issue:`1559`871- ``send_file`` supports Unicode in ``attachment_filename``.872 :pr:`2223`873- Pass ``_scheme`` argument from ``url_for`` to874 ``Flask.handle_url_build_error``. :pr:`2017`875- ``Flask.add_url_rule`` accepts the ``provide_automatic_options``876 argument to disable adding the ``OPTIONS`` method. :pr:`1489`877- ``MethodView`` subclasses inherit method handlers from base classes.878 :pr:`1936`879- Errors caused while opening the session at the beginning of the880 request are handled by the app's error handlers. :pr:`2254`881- Blueprints gained ``Blueprint.json_encoder`` and882 ``Blueprint.json_decoder`` attributes to override the app's883 encoder and decoder. :pr:`1898`884- ``Flask.make_response`` raises ``TypeError`` instead of885 ``ValueError`` for bad response types. The error messages have been886 improved to describe why the type is invalid. :pr:`2256`887- Add ``routes`` CLI command to output routes registered on the888 application. :pr:`2259`889- Show warning when session cookie domain is a bare hostname or an IP890 address, as these may not behave properly in some browsers, such as891 Chrome. :pr:`2282`892- Allow IP address as exact session cookie domain. :pr:`2282`893- ``SESSION_COOKIE_DOMAIN`` is set if it is detected through894 ``SERVER_NAME``. :pr:`2282`895- Auto-detect zero-argument app factory called ``create_app`` or896 ``make_app`` from ``FLASK_APP``. :pr:`2297`897- Factory functions are not required to take a ``script_info``898 parameter to work with the ``flask`` command. If they take a single899 parameter or a parameter named ``script_info``, the ``ScriptInfo``900 object will be passed. :pr:`2319`901- ``FLASK_APP`` can be set to an app factory, with arguments if902 needed, for example ``FLASK_APP=myproject.app:create_app('dev')``.903 :pr:`2326`904- ``FLASK_APP`` can point to local packages that are not installed in905 editable mode, although ``pip install -e`` is still preferred.906 :pr:`2414`907- The ``View`` class attribute908 ``View.provide_automatic_options`` is set in ``View.as_view``, to be909 detected by ``Flask.add_url_rule``. :pr:`2316`910- Error handling will try handlers registered for ``blueprint, code``,911 ``app, code``, ``blueprint, exception``, ``app, exception``.912 :pr:`2314`913- ``Cookie`` is added to the response's ``Vary`` header if the session914 is accessed at all during the request (and not deleted). :pr:`2288`915- ``Flask.test_request_context`` accepts ``subdomain`` and916 ``url_scheme`` arguments for use when building the base URL.917 :pr:`1621`918- Set ``APPLICATION_ROOT`` to ``'/'`` by default. This was already the919 implicit default when it was set to ``None``.920- ``TRAP_BAD_REQUEST_ERRORS`` is enabled by default in debug mode.921 ``BadRequestKeyError`` has a message with the bad key in debug mode922 instead of the generic bad request message. :pr:`2348`923- Allow registering new tags with ``TaggedJSONSerializer`` to support924 storing other types in the session cookie. :pr:`2352`925- Only open the session if the request has not been pushed onto the926 context stack yet. This allows ``stream_with_context`` generators to927 access the same session that the containing view uses. :pr:`2354`928- Add ``json`` keyword argument for the test client request methods.929 This will dump the given object as JSON and set the appropriate930 content type. :pr:`2358`931- Extract JSON handling to a mixin applied to both the ``Request`` and932 ``Response`` classes. This adds the ``Response.is_json`` and933 ``Response.get_json`` methods to the response to make testing JSON934 response much easier. :pr:`2358`935- Removed error handler caching because it caused unexpected results936 for some exception inheritance hierarchies. Register handlers937 explicitly for each exception if you want to avoid traversing the938 MRO. :pr:`2362`939- Fix incorrect JSON encoding of aware, non-UTC datetimes. :pr:`2374`940- Template auto reloading will honor debug mode even if941 ``Flask.jinja_env`` was already accessed. :pr:`2373`942- The following old deprecated code was removed. :issue:`2385`943944 - ``flask.ext`` - import extensions directly by their name instead945 of through the ``flask.ext`` namespace. For example,946 ``import flask.ext.sqlalchemy`` becomes947 ``import flask_sqlalchemy``.948 - ``Flask.init_jinja_globals`` - extend949 ``Flask.create_jinja_environment`` instead.950 - ``Flask.error_handlers`` - tracked by951 ``Flask.error_handler_spec``, use ``Flask.errorhandler``952 to register handlers.953 - ``Flask.request_globals_class`` - use954 ``Flask.app_ctx_globals_class`` instead.955 - ``Flask.static_path`` - use ``Flask.static_url_path`` instead.956 - ``Request.module`` - use ``Request.blueprint`` instead.957958- The ``Request.json`` property is no longer deprecated. :issue:`1421`959- Support passing a ``EnvironBuilder`` or ``dict`` to960 ``test_client.open``. :pr:`2412`961- The ``flask`` command and ``Flask.run`` will load environment962 variables from ``.env`` and ``.flaskenv`` files if python-dotenv is963 installed. :pr:`2416`964- When passing a full URL to the test client, the scheme in the URL is965 used instead of ``PREFERRED_URL_SCHEME``. :pr:`2430`966- ``Flask.logger`` has been simplified. ``LOGGER_NAME`` and967 ``LOGGER_HANDLER_POLICY`` config was removed. The logger is always968 named ``flask.app``. The level is only set on first access, it969 doesn't check ``Flask.debug`` each time. Only one format is used,970 not different ones depending on ``Flask.debug``. No handlers are971 removed, and a handler is only added if no handlers are already972 configured. :pr:`2436`973- Blueprint view function names may not contain dots. :pr:`2450`974- Fix a ``ValueError`` caused by invalid ``Range`` requests in some975 cases. :issue:`2526`976- The development server uses threads by default. :pr:`2529`977- Loading config files with ``silent=True`` will ignore ``ENOTDIR``978 errors. :pr:`2581`979- Pass ``--cert`` and ``--key`` options to ``flask run`` to run the980 development server over HTTPS. :pr:`2606`981- Added ``SESSION_COOKIE_SAMESITE`` to control the ``SameSite``982 attribute on the session cookie. :pr:`2607`983- Added ``Flask.test_cli_runner`` to create a Click runner that can984 invoke Flask CLI commands for testing. :pr:`2636`985- Subdomain matching is disabled by default and setting986 ``SERVER_NAME`` does not implicitly enable it. It can be enabled by987 passing ``subdomain_matching=True`` to the ``Flask`` constructor.988 :pr:`2635`989- A single trailing slash is stripped from the blueprint990 ``url_prefix`` when it is registered with the app. :pr:`2629`991- ``Request.get_json`` doesn't cache the result if parsing fails when992 ``silent`` is true. :issue:`2651`993- ``Request.get_json`` no longer accepts arbitrary encodings. Incoming994 JSON should be encoded using UTF-8 per :rfc:`8259`, but Flask will995 autodetect UTF-8, -16, or -32. :pr:`2691`996- Added ``MAX_COOKIE_SIZE`` and ``Response.max_cookie_size`` to997 control when Werkzeug warns about large cookies that browsers may998 ignore. :pr:`2693`999- Updated documentation theme to make docs look better in small1000 windows. :pr:`2709`1001- Rewrote the tutorial docs and example project to take a more1002 structured approach to help new users avoid common pitfalls.1003 :pr:`2676`100410051006Version 0.12.51007--------------10081009Released 2020-02-1010101011- Pin Werkzeug to < 1.0.0. :issue:`3497`101210131014Version 0.12.41015--------------10161017Released 2018-04-2910181019- Repackage 0.12.3 to fix package layout issue. :issue:`2728`102010211022Version 0.12.31023--------------10241025Released 2018-04-2610261027- ``Request.get_json`` no longer accepts arbitrary encodings.1028 Incoming JSON should be encoded using UTF-8 per :rfc:`8259`, but1029 Flask will autodetect UTF-8, -16, or -32. :issue:`2692`1030- Fix a Python warning about imports when using ``python -m flask``.1031 :issue:`2666`1032- Fix a ``ValueError`` caused by invalid ``Range`` requests in some1033 cases.103410351036Version 0.12.21037--------------10381039Released 2017-05-1610401041- Fix a bug in ``safe_join`` on Windows.104210431044Version 0.12.11045--------------10461047Released 2017-03-3110481049- Prevent ``flask run`` from showing a ``NoAppException`` when an1050 ``ImportError`` occurs within the imported application module.1051- Fix encoding behavior of ``app.config.from_pyfile`` for Python 3.1052 :issue:`2118`1053- Use the ``SERVER_NAME`` config if it is present as default values1054 for ``app.run``. :issue:`2109`, :pr:`2152`1055- Call ``ctx.auto_pop`` with the exception object instead of ``None``,1056 in the event that a ``BaseException`` such as ``KeyboardInterrupt``1057 is raised in a request handler.105810591060Version 0.121061------------10621063Released 2016-12-21, codename Punsch10641065- The cli command now responds to ``--version``.1066- Mimetype guessing and ETag generation for file-like objects in1067 ``send_file`` has been removed. :issue:`104`, :pr`1849`1068- Mimetype guessing in ``send_file`` now fails loudly and doesn't fall1069 back to ``application/octet-stream``. :pr:`1988`1070- Make ``flask.safe_join`` able to join multiple paths like1071 ``os.path.join`` :pr:`1730`1072- Revert a behavior change that made the dev server crash instead of1073 returning an Internal Server Error. :pr:`2006`1074- Correctly invoke response handlers for both regular request1075 dispatching as well as error handlers.1076- Disable logger propagation by default for the app logger.1077- Add support for range requests in ``send_file``.1078- ``app.test_client`` includes preset default environment, which can1079 now be directly set, instead of per ``client.get``.1080- Fix crash when running under PyPy3. :pr:`1814`108110821083Version 0.11.11084--------------10851086Released 2016-06-0710871088- Fixed a bug that prevented ``FLASK_APP=foobar/__init__.py`` from1089 working. :pr:`1872`109010911092Version 0.111093------------10941095Released 2016-05-29, codename Absinthe10961097- Added support to serializing top-level arrays to ``jsonify``. This1098 introduces a security risk in ancient browsers.1099- Added before_render_template signal.1100- Added ``**kwargs`` to ``Flask.test_client`` to support passing1101 additional keyword arguments to the constructor of1102 ``Flask.test_client_class``.1103- Added ``SESSION_REFRESH_EACH_REQUEST`` config key that controls the1104 set-cookie behavior. If set to ``True`` a permanent session will be1105 refreshed each request and get their lifetime extended, if set to1106 ``False`` it will only be modified if the session actually modifies.1107 Non permanent sessions are not affected by this and will always1108 expire if the browser window closes.1109- Made Flask support custom JSON mimetypes for incoming data.1110- Added support for returning tuples in the form ``(response,1111 headers)`` from a view function.1112- Added ``Config.from_json``.1113- Added ``Flask.config_class``.1114- Added ``Config.get_namespace``.1115- Templates are no longer automatically reloaded outside of debug1116 mode. This can be configured with the new ``TEMPLATES_AUTO_RELOAD``1117 config key.1118- Added a workaround for a limitation in Python 3.3's namespace1119 loader.1120- Added support for explicit root paths when using Python 3.3's1121 namespace packages.1122- Added ``flask`` and the ``flask.cli`` module to start the1123 local debug server through the click CLI system. This is recommended1124 over the old ``flask.run()`` method as it works faster and more1125 reliable due to a different design and also replaces1126 ``Flask-Script``.1127- Error handlers that match specific classes are now checked first,1128 thereby allowing catching exceptions that are subclasses of HTTP1129 exceptions (in ``werkzeug.exceptions``). This makes it possible for1130 an extension author to create exceptions that will by default result1131 in the HTTP error of their choosing, but may be caught with a custom1132 error handler if desired.1133- Added ``Config.from_mapping``.1134- Flask will now log by default even if debug is disabled. The log1135 format is now hardcoded but the default log handling can be disabled1136 through the ``LOGGER_HANDLER_POLICY`` configuration key.1137- Removed deprecated module functionality.1138- Added the ``EXPLAIN_TEMPLATE_LOADING`` config flag which when1139 enabled will instruct Flask to explain how it locates templates.1140 This should help users debug when the wrong templates are loaded.1141- Enforce blueprint handling in the order they were registered for1142 template loading.1143- Ported test suite to py.test.1144- Deprecated ``request.json`` in favour of ``request.get_json()``.1145- Add "pretty" and "compressed" separators definitions in jsonify()1146 method. Reduces JSON response size when1147 ``JSONIFY_PRETTYPRINT_REGULAR=False`` by removing unnecessary white1148 space included by default after separators.1149- JSON responses are now terminated with a newline character, because1150 it is a convention that UNIX text files end with a newline and some1151 clients don't deal well when this newline is missing. :pr:`1262`1152- The automatically provided ``OPTIONS`` method is now correctly1153 disabled if the user registered an overriding rule with the1154 lowercase-version ``options``. :issue:`1288`1155- ``flask.json.jsonify`` now supports the ``datetime.date`` type.1156 :pr:`1326`1157- Don't leak exception info of already caught exceptions to context1158 teardown handlers. :pr:`1393`1159- Allow custom Jinja environment subclasses. :pr:`1422`1160- Updated extension dev guidelines.1161- ``flask.g`` now has ``pop()`` and ``setdefault`` methods.1162- Turn on autoescape for ``flask.templating.render_template_string``1163 by default. :pr:`1515`1164- ``flask.ext`` is now deprecated. :pr:`1484`1165- ``send_from_directory`` now raises BadRequest if the filename is1166 invalid on the server OS. :pr:`1763`1167- Added the ``JSONIFY_MIMETYPE`` configuration variable. :pr:`1728`1168- Exceptions during teardown handling will no longer leave bad1169 application contexts lingering around.1170- Fixed broken ``test_appcontext_signals()`` test case.1171- Raise an ``AttributeError`` in ``helpers.find_package`` with a1172 useful message explaining why it is raised when a :pep:`302` import1173 hook is used without an ``is_package()`` method.1174- Fixed an issue causing exceptions raised before entering a request1175 or app context to be passed to teardown handlers.1176- Fixed an issue with query parameters getting removed from requests1177 in the test client when absolute URLs were requested.1178- Made ``@before_first_request`` into a decorator as intended.1179- Fixed an etags bug when sending a file streams with a name.1180- Fixed ``send_from_directory`` not expanding to the application root1181 path correctly.1182- Changed logic of before first request handlers to flip the flag1183 after invoking. This will allow some uses that are potentially1184 dangerous but should probably be permitted.1185- Fixed Python 3 bug when a handler from1186 ``app.url_build_error_handlers`` reraises the ``BuildError``.118711881189Version 0.10.11190--------------11911192Released 2013-06-1411931194- Fixed an issue where ``|tojson`` was not quoting single quotes which1195 made the filter not work properly in HTML attributes. Now it's1196 possible to use that filter in single quoted attributes. This should1197 make using that filter with angular.js easier.1198- Added support for byte strings back to the session system. This1199 broke compatibility with the common case of people putting binary1200 data for token verification into the session.1201- Fixed an issue where registering the same method twice for the same1202 endpoint would trigger an exception incorrectly.120312041205Version 0.101206------------12071208Released 2013-06-13, codename Limoncello12091210- Changed default cookie serialization format from pickle to JSON to1211 limit the impact an attacker can do if the secret key leaks.1212- Added ``template_test`` methods in addition to the already existing1213 ``template_filter`` method family.1214- Added ``template_global`` methods in addition to the already1215 existing ``template_filter`` method family.1216- Set the content-length header for x-sendfile.1217- ``tojson`` filter now does not escape script blocks in HTML51218 parsers.1219- ``tojson`` used in templates is now safe by default. This was1220 allowed due to the different escaping behavior.1221- Flask will now raise an error if you attempt to register a new1222 function on an already used endpoint.1223- Added wrapper module around simplejson and added default1224 serialization of datetime objects. This allows much easier1225 customization of how JSON is handled by Flask or any Flask1226 extension.1227- Removed deprecated internal ``flask.session`` module alias. Use1228 ``flask.sessions`` instead to get the session module. This is not to1229 be confused with ``flask.session`` the session proxy.1230- Templates can now be rendered without request context. The behavior1231 is slightly different as the ``request``, ``session`` and ``g``1232 objects will not be available and blueprint's context processors are1233 not called.1234- The config object is now available to the template as a real global1235 and not through a context processor which makes it available even in1236 imported templates by default.1237- Added an option to generate non-ascii encoded JSON which should1238 result in less bytes being transmitted over the network. It's1239 disabled by default to not cause confusion with existing libraries1240 that might expect ``flask.json.dumps`` to return bytes by default.1241- ``flask.g`` is now stored on the app context instead of the request1242 context.1243- ``flask.g`` now gained a ``get()`` method for not erroring out on1244 non existing items.1245- ``flask.g`` now can be used with the ``in`` operator to see what's1246 defined and it now is iterable and will yield all attributes stored.1247- ``flask.Flask.request_globals_class`` got renamed to1248 ``flask.Flask.app_ctx_globals_class`` which is a better name to what1249 it does since 0.10.1250- ``request``, ``session`` and ``g`` are now also added as proxies to1251 the template context which makes them available in imported1252 templates. One has to be very careful with those though because1253 usage outside of macros might cause caching.1254- Flask will no longer invoke the wrong error handlers if a proxy1255 exception is passed through.1256- Added a workaround for chrome's cookies in localhost not working as1257 intended with domain names.1258- Changed logic for picking defaults for cookie values from sessions1259 to work better with Google Chrome.1260- Added ``message_flashed`` signal that simplifies flashing testing.1261- Added support for copying of request contexts for better working1262 with greenlets.1263- Removed custom JSON HTTP exception subclasses. If you were relying1264 on them you can reintroduce them again yourself trivially. Using1265 them however is strongly discouraged as the interface was flawed.1266- Python requirements changed: requiring Python 2.6 or 2.7 now to1267 prepare for Python 3.3 port.1268- Changed how the teardown system is informed about exceptions. This1269 is now more reliable in case something handles an exception halfway1270 through the error handling process.1271- Request context preservation in debug mode now keeps the exception1272 information around which means that teardown handlers are able to1273 distinguish error from success cases.1274- Added the ``JSONIFY_PRETTYPRINT_REGULAR`` configuration variable.1275- Flask now orders JSON keys by default to not trash HTTP caches due1276 to different hash seeds between different workers.1277- Added ``appcontext_pushed`` and ``appcontext_popped`` signals.1278- The builtin run method now takes the ``SERVER_NAME`` into account1279 when picking the default port to run on.1280- Added ``flask.request.get_json()`` as a replacement for the old1281 ``flask.request.json`` property.128212831284Version 0.91285-----------12861287Released 2012-07-01, codename Campari12881289- The ``Request.on_json_loading_failed`` now returns a JSON formatted1290 response by default.1291- The ``url_for`` function now can generate anchors to the generated1292 links.1293- The ``url_for`` function now can also explicitly generate URL rules1294 specific to a given HTTP method.1295- Logger now only returns the debug log setting if it was not set1296 explicitly.1297- Unregister a circular dependency between the WSGI environment and1298 the request object when shutting down the request. This means that1299 environ ``werkzeug.request`` will be ``None`` after the response was1300 returned to the WSGI server but has the advantage that the garbage1301 collector is not needed on CPython to tear down the request unless1302 the user created circular dependencies themselves.1303- Session is now stored after callbacks so that if the session payload1304 is stored in the session you can still modify it in an after request1305 callback.1306- The ``Flask`` class will avoid importing the provided import name if1307 it can (the required first parameter), to benefit tools which build1308 Flask instances programmatically. The Flask class will fall back to1309 using import on systems with custom module hooks, e.g. Google App1310 Engine, or when the import name is inside a zip archive (usually an1311 egg) prior to Python 2.7.1312- Blueprints now have a decorator to add custom template filters1313 application wide, ``Blueprint.app_template_filter``.1314- The Flask and Blueprint classes now have a non-decorator method for1315 adding custom template filters application wide,1316 ``Flask.add_template_filter`` and1317 ``Blueprint.add_app_template_filter``.1318- The ``get_flashed_messages`` function now allows rendering flashed1319 message categories in separate blocks, through a ``category_filter``1320 argument.1321- The ``Flask.run`` method now accepts ``None`` for ``host`` and1322 ``port`` arguments, using default values when ``None``. This allows1323 for calling run using configuration values, e.g.1324 ``app.run(app.config.get('MYHOST'), app.config.get('MYPORT'))``,1325 with proper behavior whether or not a config file is provided.1326- The ``render_template`` method now accepts a either an iterable of1327 template names or a single template name. Previously, it only1328 accepted a single template name. On an iterable, the first template1329 found is rendered.1330- Added ``Flask.app_context`` which works very similar to the request1331 context but only provides access to the current application. This1332 also adds support for URL generation without an active request1333 context.1334- View functions can now return a tuple with the first instance being1335 an instance of ``Response``. This allows for returning1336 ``jsonify(error="error msg"), 400`` from a view function.1337- ``Flask`` and ``Blueprint`` now provide a ``get_send_file_max_age``1338 hook for subclasses to override behavior of serving static files1339 from Flask when using ``Flask.send_static_file`` (used for the1340 default static file handler) and ``helpers.send_file``. This hook is1341 provided a filename, which for example allows changing cache1342 controls by file extension. The default max-age for ``send_file``1343 and static files can be configured through a new1344 ``SEND_FILE_MAX_AGE_DEFAULT`` configuration variable, which is used1345 in the default ``get_send_file_max_age`` implementation.1346- Fixed an assumption in sessions implementation which could break1347 message flashing on sessions implementations which use external1348 storage.1349- Changed the behavior of tuple return values from functions. They are1350 no longer arguments to the response object, they now have a defined1351 meaning.1352- Added ``Flask.request_globals_class`` to allow a specific class to1353 be used on creation of the ``g`` instance of each request.1354- Added ``required_methods`` attribute to view functions to force-add1355 methods on registration.1356- Added ``flask.after_this_request``.1357- Added ``flask.stream_with_context`` and the ability to push contexts1358 multiple times without producing unexpected behavior.135913601361Version 0.8.11362-------------13631364Released 2012-07-0113651366- Fixed an issue with the undocumented ``flask.session`` module to not1367 work properly on Python 2.5. It should not be used but did cause1368 some problems for package managers.136913701371Version 0.81372-----------13731374Released 2011-09-29, codename Rakija13751376- Refactored session support into a session interface so that the1377 implementation of the sessions can be changed without having to1378 override the Flask class.1379- Empty session cookies are now deleted properly automatically.1380- View functions can now opt out of getting the automatic OPTIONS1381 implementation.1382- HTTP exceptions and Bad Request errors can now be trapped so that1383 they show up normally in the traceback.1384- Flask in debug mode is now detecting some common problems and tries1385 to warn you about them.1386- Flask in debug mode will now complain with an assertion error if a1387 view was attached after the first request was handled. This gives1388 earlier feedback when users forget to import view code ahead of1389 time.1390- Added the ability to register callbacks that are only triggered once1391 at the beginning of the first request with1392 ``Flask.before_first_request``.1393- Malformed JSON data will now trigger a bad request HTTP exception1394 instead of a value error which usually would result in a 5001395 internal server error if not handled. This is a backwards1396 incompatible change.1397- Applications now not only have a root path where the resources and1398 modules are located but also an instance path which is the1399 designated place to drop files that are modified at runtime (uploads1400 etc.). Also this is conceptually only instance depending and outside1401 version control so it's the perfect place to put configuration files1402 etc.1403- Added the ``APPLICATION_ROOT`` configuration variable.1404- Implemented ``TestClient.session_transaction`` to easily modify1405 sessions from the test environment.1406- Refactored test client internally. The ``APPLICATION_ROOT``1407 configuration variable as well as ``SERVER_NAME`` are now properly1408 used by the test client as defaults.1409- Added ``View.decorators`` to support simpler decorating of pluggable1410 (class-based) views.1411- Fixed an issue where the test client if used with the "with"1412 statement did not trigger the execution of the teardown handlers.1413- Added finer control over the session cookie parameters.1414- HEAD requests to a method view now automatically dispatch to the1415 ``get`` method if no handler was implemented.1416- Implemented the virtual ``flask.ext`` package to import extensions1417 from.1418- The context preservation on exceptions is now an integral component1419 of Flask itself and no longer of the test client. This cleaned up1420 some internal logic and lowers the odds of runaway request contexts1421 in unittests.1422- Fixed the Jinja environment's ``list_templates`` method not1423 returning the correct names when blueprints or modules were1424 involved.142514261427Version 0.7.21428-------------14291430Released 2011-07-0614311432- Fixed an issue with URL processors not properly working on1433 blueprints.143414351436Version 0.7.11437-------------14381439Released 2011-06-2914401441- Added missing future import that broke 2.5 compatibility.1442- Fixed an infinite redirect issue with blueprints.144314441445Version 0.71446-----------14471448Released 2011-06-28, codename Grappa14491450- Added ``Flask.make_default_options_response`` which can be used by1451 subclasses to alter the default behavior for ``OPTIONS`` responses.1452- Unbound locals now raise a proper ``RuntimeError`` instead of an1453 ``AttributeError``.1454- Mimetype guessing and etag support based on file objects is now1455 deprecated for ``send_file`` because it was unreliable. Pass1456 filenames instead or attach your own etags and provide a proper1457 mimetype by hand.1458- Static file handling for modules now requires the name of the static1459 folder to be supplied explicitly. The previous autodetection was not1460 reliable and caused issues on Google's App Engine. Until 1.0 the old1461 behavior will continue to work but issue dependency warnings.1462- Fixed a problem for Flask to run on jython.1463- Added a ``PROPAGATE_EXCEPTIONS`` configuration variable that can be1464 used to flip the setting of exception propagation which previously1465 was linked to ``DEBUG`` alone and is now linked to either ``DEBUG``1466 or ``TESTING``.1467- Flask no longer internally depends on rules being added through the1468 ``add_url_rule`` function and can now also accept regular werkzeug1469 rules added to the url map.1470- Added an ``endpoint`` method to the flask application object which1471 allows one to register a callback to an arbitrary endpoint with a1472 decorator.1473- Use Last-Modified for static file sending instead of Date which was1474 incorrectly introduced in 0.6.1475- Added ``create_jinja_loader`` to override the loader creation1476 process.1477- Implemented a silent flag for ``config.from_pyfile``.1478- Added ``teardown_request`` decorator, for functions that should run1479 at the end of a request regardless of whether an exception occurred.1480 Also the behavior for ``after_request`` was changed. It's now no1481 longer executed when an exception is raised.1482- Implemented ``has_request_context``.1483- Deprecated ``init_jinja_globals``. Override the1484 ``Flask.create_jinja_environment`` method instead to achieve the1485 same functionality.1486- Added ``safe_join``.1487- The automatic JSON request data unpacking now looks at the charset1488 mimetype parameter.1489- Don't modify the session on ``get_flashed_messages`` if there are no1490 messages in the session.1491- ``before_request`` handlers are now able to abort requests with1492 errors.1493- It is not possible to define user exception handlers. That way you1494 can provide custom error messages from a central hub for certain1495 errors that might occur during request processing (for instance1496 database connection errors, timeouts from remote resources etc.).1497- Blueprints can provide blueprint specific error handlers.1498- Implemented generic class-based views.149915001501Version 0.6.11502-------------15031504Released 2010-12-3115051506- Fixed an issue where the default ``OPTIONS`` response was not1507 exposing all valid methods in the ``Allow`` header.1508- Jinja template loading syntax now allows "./" in front of a1509 template load path. Previously this caused issues with module1510 setups.1511- Fixed an issue where the subdomain setting for modules was ignored1512 for the static folder.1513- Fixed a security problem that allowed clients to download arbitrary1514 files if the host server was a windows based operating system and1515 the client uses backslashes to escape the directory the files where1516 exposed from.151715181519Version 0.61520-----------15211522Released 2010-07-27, codename Whisky15231524- After request functions are now called in reverse order of1525 registration.1526- OPTIONS is now automatically implemented by Flask unless the1527 application explicitly adds 'OPTIONS' as method to the URL rule. In1528 this case no automatic OPTIONS handling kicks in.1529- Static rules are now even in place if there is no static folder for1530 the module. This was implemented to aid GAE which will remove the1531 static folder if it's part of a mapping in the .yml file.1532- ``Flask.config`` is now available in the templates as ``config``.1533- Context processors will no longer override values passed directly to1534 the render function.1535- Added the ability to limit the incoming request data with the new1536 ``MAX_CONTENT_LENGTH`` configuration value.1537- The endpoint for the ``Module.add_url_rule`` method is now optional1538 to be consistent with the function of the same name on the1539 application object.1540- Added a ``make_response`` function that simplifies creating response1541 object instances in views.1542- Added signalling support based on blinker. This feature is currently1543 optional and supposed to be used by extensions and applications. If1544 you want to use it, make sure to have ``blinker`` installed.1545- Refactored the way URL adapters are created. This process is now1546 fully customizable with the ``Flask.create_url_adapter`` method.1547- Modules can now register for a subdomain instead of just an URL1548 prefix. This makes it possible to bind a whole module to a1549 configurable subdomain.155015511552Version 0.5.21553-------------15541555Released 2010-07-1515561557- Fixed another issue with loading templates from directories when1558 modules were used.155915601561Version 0.5.11562-------------15631564Released 2010-07-0615651566- Fixes an issue with template loading from directories when modules1567 where used.156815691570Version 0.51571-----------15721573Released 2010-07-06, codename Calvados15741575- Fixed a bug with subdomains that was caused by the inability to1576 specify the server name. The server name can now be set with the1577 ``SERVER_NAME`` config key. This key is now also used to set the1578 session cookie cross-subdomain wide.1579- Autoescaping is no longer active for all templates. Instead it is1580 only active for ``.html``, ``.htm``, ``.xml`` and ``.xhtml``. Inside1581 templates this behavior can be changed with the ``autoescape`` tag.1582- Refactored Flask internally. It now consists of more than a single1583 file.1584- ``send_file`` now emits etags and has the ability to do conditional1585 responses builtin.1586- (temporarily) dropped support for zipped applications. This was a1587 rarely used feature and led to some confusing behavior.1588- Added support for per-package template and static-file directories.1589- Removed support for ``create_jinja_loader`` which is no longer used1590 in 0.5 due to the improved module support.1591- Added a helper function to expose files from any directory.159215931594Version 0.41595-----------15961597Released 2010-06-18, codename Rakia15981599- Added the ability to register application wide error handlers from1600 modules.1601- ``Flask.after_request`` handlers are now also invoked if the request1602 dies with an exception and an error handling page kicks in.1603- Test client has not the ability to preserve the request context for1604 a little longer. This can also be used to trigger custom requests1605 that do not pop the request stack for testing.1606- Because the Python standard library caches loggers, the name of the1607 logger is configurable now to better support unittests.1608- Added ``TESTING`` switch that can activate unit testing helpers.1609- The logger switches to ``DEBUG`` mode now if debug is enabled.161016111612Version 0.3.11613-------------16141615Released 2010-05-2816161617- Fixed a error reporting bug with ``Config.from_envvar``.1618- Removed some unused code.1619- Release does no longer include development leftover files (.git1620 folder for themes, built documentation in zip and pdf file and some1621 .pyc files)162216231624Version 0.31625-----------16261627Released 2010-05-28, codename Schnaps16281629- Added support for categories for flashed messages.1630- The application now configures a ``logging.Handler`` and will log1631 request handling exceptions to that logger when not in debug mode.1632 This makes it possible to receive mails on server errors for1633 example.1634- Added support for context binding that does not require the use of1635 the with statement for playing in the console.1636- The request context is now available within the with statement1637 making it possible to further push the request context or pop it.1638- Added support for configurations.163916401641Version 0.21642-----------16431644Released 2010-05-12, codename Jägermeister16451646- Various bugfixes1647- Integrated JSON support1648- Added ``get_template_attribute`` helper function.1649- ``Flask.add_url_rule`` can now also register a view function.1650- Refactored internal request dispatching.1651- Server listens on 127.0.0.1 by default now to fix issues with1652 chrome.1653- Added external URL support.1654- Added support for ``send_file``.1655- Module support and internal request handling refactoring to better1656 support pluggable applications.1657- Sessions can be set to be permanent now on a per-session basis.1658- Better error reporting on missing secret keys.1659- Added support for Google Appengine.166016611662Version 0.11663-----------16641665Released 2010-04-1616661667- First public preview release.