diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 220046ed..00000000 --- a/AUTHORS +++ /dev/null @@ -1,12 +0,0 @@ -Flask is developed and maintained by the Pallets team and community -contributors. It was created by Armin Ronacher. The core maintainers -are: - -- David Lord (davidism) -- Adrian Mönnich (ThiefMaster) -- Armin Ronacher (mitsuhiko) -- Marcus Unterwaditzer (untitaker) - -A full list of contributors is available from git with:: - - git shortlog -sne diff --git a/CHANGES.rst b/CHANGES.rst index 7bf67554..eaa5d262 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,9 +1,5 @@ .. currentmodule:: flask -Flask Changelog -=============== - - Version 1.1.0 ------------- @@ -24,15 +20,15 @@ Unreleased - :meth:`flask.RequestContext.copy` includes the current session object in the request context copy. This prevents ``session`` - pointing to an out-of-date object. (`#2935`_) + 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. (`#2994`_) + previously. :pr:`2994` - :func:`send_file` supports :class:`~os.PathLike` objects as described in PEP 0519, to support :mod:`pathlib` in Python 3. - (`#3059`_) + :pr:`3059` - :func:`send_file` supports :class:`~io.BytesIO` partial content. - (`#2957`_) + :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 @@ -87,13 +83,6 @@ Unreleased the app and request contexts, such as to query a database for an id. :issue:`3088` -.. _#2935: https://github.com/pallets/flask/issues/2935 -.. _#2957: https://github.com/pallets/flask/issues/2957 -.. _#2994: https://github.com/pallets/flask/pull/2994 -.. _#3059: https://github.com/pallets/flask/pull/3059 -.. _#3179: https://github.com/pallets/flask/pull/3179 -.. _#3125: https://github.com/pallets/flask/pull/3125 - Version 1.0.3 ------------- @@ -102,27 +91,21 @@ Released 2019-05-17 - :func:`send_file` encodes filenames as ASCII instead of Latin-1 (ISO-8859-1). This fixes compatibility with Gunicorn, which is - stricter about header encodings than PEP 3333. (`#2766`_) + stricter about header encodings than PEP 3333. :issue:`2766` - Allow custom CLIs using ``FlaskGroup`` to set the debug flag without it always being overwritten based on environment variables. - (`#2765`_) + :pr:`2765` - ``flask --version`` outputs Werkzeug's version and simplifies the - Python version. (`#2825`_) + Python version. :pr:`2825` - :func:`send_file` handles an ``attachment_filename`` that is a - native Python 2 string (bytes) with UTF-8 coded bytes. (`#2933`_) + native Python 2 string (bytes) with UTF-8 coded bytes. :issue:`2933` - A catch-all error handler registered for ``HTTPException`` will not handle ``RoutingException``, which is used internally during routing. This fixes the unexpected behavior that had been introduced - in 1.0. (`#2986`_) + in 1.0. :pr:`2986` - Passing the ``json`` argument to ``app.test_client`` does not - push/pop an extra app context. (`#2900`_) + push/pop an extra app context. :issue:`2900` -.. _#2766: https://github.com/pallets/flask/issues/2766 -.. _#2765: https://github.com/pallets/flask/pull/2765 -.. _#2825: https://github.com/pallets/flask/pull/2825 -.. _#2900: https://github.com/pallets/flask/issues/2900 -.. _#2933: https://github.com/pallets/flask/issues/2933 -.. _#2986: https://github.com/pallets/flask/pull/2986 Version 1.0.2 ------------- @@ -130,12 +113,9 @@ Version 1.0.2 Released 2018-05-02 - Fix more backwards compatibility issues with merging slashes between - a blueprint prefix and route. (`#2748`_) + a blueprint prefix and route. :pr:`2748` - Fix error with ``flask routes`` command when there are no routes. - (`#2751`_) - -.. _#2748: https://github.com/pallets/flask/pull/2748 -.. _#2751: https://github.com/pallets/flask/issues/2751 + :issue:`2751` Version 1.0.1 @@ -144,24 +124,17 @@ Version 1.0.1 Released 2018-04-29 - Fix registering partials (with no ``__name__``) as view functions. - (`#2730`_) + :pr:`2730` - Don't treat lists returned from view functions the same as tuples. - Only tuples are interpreted as response data. (`#2736`_) + Only tuples are interpreted as response data. :issue:`2736` - Extra slashes between a blueprint's ``url_prefix`` and a route URL are merged. This fixes some backwards compatibility issues with the - change in 1.0. (`#2731`_, `#2742`_) + change in 1.0. :issue:`2731`, :issue:`2742` - Only trap ``BadRequestKeyError`` errors in debug mode, not all ``BadRequest`` errors. This allows ``abort(400)`` to continue - working as expected. (`#2735`_) + working as expected. :issue:`2735` - The ``FLASK_SKIP_DOTENV`` environment variable can be set to ``1`` - to skip automatically loading dotenv files. (`#2722`_) - -.. _#2722: https://github.com/pallets/flask/issues/2722 -.. _#2730: https://github.com/pallets/flask/pull/2730 -.. _#2731: https://github.com/pallets/flask/issues/2731 -.. _#2735: https://github.com/pallets/flask/issues/2735 -.. _#2736: https://github.com/pallets/flask/issues/2736 -.. _#2742: https://github.com/pallets/flask/issues/2742 + to skip automatically loading dotenv files. :issue:`2722` Version 1.0 @@ -169,97 +142,97 @@ Version 1.0 Released 2018-04-26 -- **Python 2.6 and 3.3 are no longer supported.** (`pallets/meta#24`_) +- Python 2.6 and 3.3 are no longer supported. - Bump minimum dependency versions to the latest stable versions: Werkzeug >= 0.14, Jinja >= 2.10, itsdangerous >= 0.24, Click >= 5.1. - (`#2586`_) + :issue:`2586` - Skip :meth:`app.run ` when a Flask application is run from the command line. This avoids some behavior that was confusing to debug. - Change the default for :data:`JSONIFY_PRETTYPRINT_REGULAR` to ``False``. :func:`~json.jsonify` returns a compact format by - default, and an indented format in debug mode. (`#2193`_) + default, and an indented format in debug mode. :pr:`2193` - :meth:`Flask.__init__ ` accepts the ``host_matching`` - argument and sets it on :attr:`~Flask.url_map`. (`#1559`_) + argument and sets it on :attr:`~Flask.url_map`. :issue:`1559` - :meth:`Flask.__init__ ` accepts the ``static_host`` argument and passes it as the ``host`` argument when defining the static - route. (`#1559`_) + route. :issue:`1559` - :func:`send_file` supports Unicode in ``attachment_filename``. - (`#2223`_) + :pr:`2223` - Pass ``_scheme`` argument from :func:`url_for` to - :meth:`~Flask.handle_url_build_error`. (`#2017`_) + :meth:`~Flask.handle_url_build_error`. :pr:`2017` - :meth:`~Flask.add_url_rule` accepts the ``provide_automatic_options`` argument to disable adding the - ``OPTIONS`` method. (`#1489`_) + ``OPTIONS`` method. :pr:`1489` - :class:`~views.MethodView` subclasses inherit method handlers from - base classes. (`#1936`_) + base classes. :pr:`1936` - Errors caused while opening the session at the beginning of the - request are handled by the app's error handlers. (`#2254`_) + request are handled by the app's error handlers. :pr:`2254` - Blueprints gained :attr:`~Blueprint.json_encoder` and :attr:`~Blueprint.json_decoder` attributes to override the app's - encoder and decoder. (`#1898`_) + encoder and decoder. :pr:`1898` - :meth:`Flask.make_response` raises ``TypeError`` instead of ``ValueError`` for bad response types. The error messages have been - improved to describe why the type is invalid. (`#2256`_) + improved to describe why the type is invalid. :pr:`2256` - Add ``routes`` CLI command to output routes registered on the - application. (`#2259`_) + application. :pr:`2259` - Show warning when session cookie domain is a bare hostname or an IP address, as these may not behave properly in some browsers, such as - Chrome. (`#2282`_) -- Allow IP address as exact session cookie domain. (`#2282`_) + Chrome. :pr:`2282` +- Allow IP address as exact session cookie domain. :pr:`2282` - ``SESSION_COOKIE_DOMAIN`` is set if it is detected through - ``SERVER_NAME``. (`#2282`_) + ``SERVER_NAME``. :pr:`2282` - Auto-detect zero-argument app factory called ``create_app`` or - ``make_app`` from ``FLASK_APP``. (`#2297`_) + ``make_app`` from ``FLASK_APP``. :pr:`2297` - Factory functions are not required to take a ``script_info`` parameter to work with the ``flask`` command. If they take a single parameter or a parameter named ``script_info``, the - :class:`~cli.ScriptInfo` object will be passed. (`#2319`_) + :class:`~cli.ScriptInfo` object will be passed. :pr:`2319` - ``FLASK_APP`` can be set to an app factory, with arguments if needed, for example ``FLASK_APP=myproject.app:create_app('dev')``. - (`#2326`_) + :pr:`2326` - ``FLASK_APP`` can point to local packages that are not installed in editable mode, although ``pip install -e`` is still preferred. - (`#2414`_) + :pr:`2414` - The :class:`~views.View` class attribute :attr:`~views.View.provide_automatic_options` is set in :meth:`~views.View.as_view`, to be detected by - :meth:`~Flask.add_url_rule`. (`#2316`_) + :meth:`~Flask.add_url_rule`. :pr:`2316` - Error handling will try handlers registered for ``blueprint, code``, ``app, code``, ``blueprint, exception``, ``app, exception``. - (`#2314`_) + :pr:`2314` - ``Cookie`` is added to the response's ``Vary`` header if the session - is accessed at all during the request (and not deleted). (`#2288`_) + is accessed at all during the request (and not deleted). :pr:`2288` - :meth:`~Flask.test_request_context` accepts ``subdomain`` and ``url_scheme`` arguments for use when building the base URL. - (`#1621`_) + :pr:`1621` - Set :data:`APPLICATION_ROOT` to ``'/'`` by default. This was already the implicit default when it was set to ``None``. - :data:`TRAP_BAD_REQUEST_ERRORS` is enabled by default in debug mode. ``BadRequestKeyError`` has a message with the bad key in debug mode - instead of the generic bad request message. (`#2348`_) + instead of the generic bad request message. :pr:`2348` - Allow registering new tags with :class:`~json.tag.TaggedJSONSerializer` to support storing other - types in the session cookie. (`#2352`_) + types in the session cookie. :pr:`2352` - Only open the session if the request has not been pushed onto the context stack yet. This allows :func:`~stream_with_context` generators to access the same session that the containing view uses. - (`#2354`_) + :pr:`2354` - Add ``json`` keyword argument for the test client request methods. This will dump the given object as JSON and set the appropriate - content type. (`#2358`_) + content type. :pr:`2358` - Extract JSON handling to a mixin applied to both the :class:`Request` and :class:`Response` classes. This adds the :meth:`~Response.is_json` and :meth:`~Response.get_json` methods to - the response to make testing JSON response much easier. (`#2358`_) + the response to make testing JSON response much easier. :pr:`2358` - Removed error handler caching because it caused unexpected results for some exception inheritance hierarchies. Register handlers explicitly for each exception if you want to avoid traversing the - MRO. (`#2362`_) -- Fix incorrect JSON encoding of aware, non-UTC datetimes. (`#2374`_) + MRO. :pr:`2362` +- Fix incorrect JSON encoding of aware, non-UTC datetimes. :pr:`2374` - Template auto reloading will honor debug mode even even if - :attr:`~Flask.jinja_env` was already accessed. (`#2373`_) -- The following old deprecated code was removed. (`#2385`_) + :attr:`~Flask.jinja_env` was already accessed. :pr:`2373` +- The following old deprecated code was removed. :issue:`2385` - ``flask.ext`` - import extensions directly by their name instead of through the ``flask.ext`` namespace. For example, @@ -277,763 +250,720 @@ Released 2018-04-26 - ``Request.module`` - use :attr:`Request.blueprint` instead. - The :attr:`Request.json` property is no longer deprecated. - (`#1421`_) -- Support passing a :class:`~werkzeug.test.EnvironBuilder` or - ``dict`` to :meth:`test_client.open `. - (`#2412`_) + :issue:`1421` +- Support passing a :class:`~werkzeug.test.EnvironBuilder` or ``dict`` + to :meth:`test_client.open `. :pr:`2412` - The ``flask`` command and :meth:`Flask.run` will load environment variables from ``.env`` and ``.flaskenv`` files if python-dotenv is - installed. (`#2416`_) + installed. :pr:`2416` - When passing a full URL to the test client, the scheme in the URL is - used instead of :data:`PREFERRED_URL_SCHEME`. (`#2430`_) + used instead of :data:`PREFERRED_URL_SCHEME`. :pr:`2430` - :attr:`Flask.logger` has been simplified. ``LOGGER_NAME`` and ``LOGGER_HANDLER_POLICY`` config was removed. The logger is always named ``flask.app``. The level is only set on first access, it doesn't check :attr:`Flask.debug` each time. Only one format is used, not different ones depending on :attr:`Flask.debug`. No handlers are removed, and a handler is only added if no handlers are - already configured. (`#2436`_) -- Blueprint view function names may not contain dots. (`#2450`_) + already configured. :pr:`2436` +- Blueprint view function names may not contain dots. :pr:`2450` - Fix a ``ValueError`` caused by invalid ``Range`` requests in some - cases. (`#2526`_) -- The development server uses threads by default. (`#2529`_) + cases. :issue:`2526` +- The development server uses threads by default. :pr:`2529` - Loading config files with ``silent=True`` will ignore - :data:`~errno.ENOTDIR` errors. (`#2581`_) + :data:`~errno.ENOTDIR` errors. :pr:`2581` - Pass ``--cert`` and ``--key`` options to ``flask run`` to run the - development server over HTTPS. (`#2606`_) + development server over HTTPS. :pr:`2606` - Added :data:`SESSION_COOKIE_SAMESITE` to control the ``SameSite`` - attribute on the session cookie. (`#2607`_) + attribute on the session cookie. :pr:`2607` - Added :meth:`~flask.Flask.test_cli_runner` to create a Click runner - that can invoke Flask CLI commands for testing. (`#2636`_) + that can invoke Flask CLI commands for testing. :pr:`2636` - Subdomain matching is disabled by default and setting :data:`SERVER_NAME` does not implicitly enable it. It can be enabled by passing ``subdomain_matching=True`` to the ``Flask`` constructor. - (`#2635`_) + :pr:`2635` - A single trailing slash is stripped from the blueprint - ``url_prefix`` when it is registered with the app. (`#2629`_) -- :meth:`Request.get_json` doesn't cache the - result if parsing fails when ``silent`` is true. (`#2651`_) + ``url_prefix`` when it is registered with the app. :pr:`2629` +- :meth:`Request.get_json` doesn't cache the result if parsing fails + when ``silent`` is true. :issue:`2651` - :func:`Request.get_json` no longer accepts arbitrary encodings. Incoming JSON should be encoded using UTF-8 per :rfc:`8259`, but - Flask will autodetect UTF-8, -16, or -32. (`#2691`_) + Flask will autodetect UTF-8, -16, or -32. :pr:`2691` - Added :data:`MAX_COOKIE_SIZE` and :attr:`Response.max_cookie_size` to control when Werkzeug warns about large cookies that browsers may - ignore. (`#2693`_) + ignore. :pr:`2693` - Updated documentation theme to make docs look better in small - windows. (`#2709`_) + windows. :pr:`2709` - Rewrote the tutorial docs and example project to take a more structured approach to help new users avoid common pitfalls. - (`#2676`_) - -.. _pallets/meta#24: https://github.com/pallets/meta/issues/24 -.. _#1421: https://github.com/pallets/flask/issues/1421 -.. _#1489: https://github.com/pallets/flask/pull/1489 -.. _#1559: https://github.com/pallets/flask/issues/1559 -.. _#1621: https://github.com/pallets/flask/pull/1621 -.. _#1898: https://github.com/pallets/flask/pull/1898 -.. _#1936: https://github.com/pallets/flask/pull/1936 -.. _#2017: https://github.com/pallets/flask/pull/2017 -.. _#2193: https://github.com/pallets/flask/pull/2193 -.. _#2223: https://github.com/pallets/flask/pull/2223 -.. _#2254: https://github.com/pallets/flask/pull/2254 -.. _#2256: https://github.com/pallets/flask/pull/2256 -.. _#2259: https://github.com/pallets/flask/pull/2259 -.. _#2282: https://github.com/pallets/flask/pull/2282 -.. _#2288: https://github.com/pallets/flask/pull/2288 -.. _#2297: https://github.com/pallets/flask/pull/2297 -.. _#2314: https://github.com/pallets/flask/pull/2314 -.. _#2316: https://github.com/pallets/flask/pull/2316 -.. _#2319: https://github.com/pallets/flask/pull/2319 -.. _#2326: https://github.com/pallets/flask/pull/2326 -.. _#2348: https://github.com/pallets/flask/pull/2348 -.. _#2352: https://github.com/pallets/flask/pull/2352 -.. _#2354: https://github.com/pallets/flask/pull/2354 -.. _#2358: https://github.com/pallets/flask/pull/2358 -.. _#2362: https://github.com/pallets/flask/pull/2362 -.. _#2374: https://github.com/pallets/flask/pull/2374 -.. _#2373: https://github.com/pallets/flask/pull/2373 -.. _#2385: https://github.com/pallets/flask/issues/2385 -.. _#2412: https://github.com/pallets/flask/pull/2412 -.. _#2414: https://github.com/pallets/flask/pull/2414 -.. _#2416: https://github.com/pallets/flask/pull/2416 -.. _#2430: https://github.com/pallets/flask/pull/2430 -.. _#2436: https://github.com/pallets/flask/pull/2436 -.. _#2450: https://github.com/pallets/flask/pull/2450 -.. _#2526: https://github.com/pallets/flask/issues/2526 -.. _#2529: https://github.com/pallets/flask/pull/2529 -.. _#2586: https://github.com/pallets/flask/issues/2586 -.. _#2581: https://github.com/pallets/flask/pull/2581 -.. _#2606: https://github.com/pallets/flask/pull/2606 -.. _#2607: https://github.com/pallets/flask/pull/2607 -.. _#2636: https://github.com/pallets/flask/pull/2636 -.. _#2635: https://github.com/pallets/flask/pull/2635 -.. _#2629: https://github.com/pallets/flask/pull/2629 -.. _#2651: https://github.com/pallets/flask/issues/2651 -.. _#2676: https://github.com/pallets/flask/pull/2676 -.. _#2691: https://github.com/pallets/flask/pull/2691 -.. _#2693: https://github.com/pallets/flask/pull/2693 -.. _#2709: https://github.com/pallets/flask/pull/2709 + :pr:`2676` Version 0.12.4 -------------- -Released on April 29 2018 +Released 2018-04-29 -- Repackage 0.12.3 to fix package layout issue. (`#2728`_) - -.. _#2728: https://github.com/pallets/flask/issues/2728 +- Repackage 0.12.3 to fix package layout issue. :issue:`2728` Version 0.12.3 -------------- -Released on April 26th 2018 +Released 2018-04-26 - :func:`Request.get_json` no longer accepts arbitrary encodings. Incoming JSON should be encoded using UTF-8 per :rfc:`8259`, but - Flask will autodetect UTF-8, -16, or -32. (`#2692`_) + Flask will autodetect UTF-8, -16, or -32. :issue:`2692` - Fix a Python warning about imports when using ``python -m flask``. - (`#2666`_) + :issue:`2666` - Fix a ``ValueError`` caused by invalid ``Range`` requests in some cases. -.. _#2666: https://github.com/pallets/flask/issues/2666 -.. _#2692: https://github.com/pallets/flask/issues/2692 - Version 0.12.2 -------------- -Released on May 16 2017 +Released 2017-05-16 + +- Fix a bug in ``safe_join`` on Windows. -- Fix a bug in `safe_join` on Windows. Version 0.12.1 -------------- -Bugfix release, released on March 31st 2017 +Released 2017-03-31 + +- Prevent ``flask run`` from showing a ``NoAppException`` when an + ``ImportError`` occurs within the imported application module. +- Fix encoding behavior of ``app.config.from_pyfile`` for Python 3. + :issue:`2118` +- Use the ``SERVER_NAME`` config if it is present as default values + for ``app.run``. :issue:`2109`, :pr:`2152` +- Call ``ctx.auto_pop`` with the exception object instead of ``None``, + in the event that a ``BaseException`` such as ``KeyboardInterrupt`` + is raised in a request handler. -- Prevent `flask run` from showing a NoAppException when an ImportError occurs - within the imported application module. -- Fix encoding behavior of ``app.config.from_pyfile`` for Python 3. Fix - ``#2118``. -- Use the ``SERVER_NAME`` config if it is present as default values for - ``app.run``. ``#2109``, ``#2152`` -- Call `ctx.auto_pop` with the exception object instead of `None`, in the - event that a `BaseException` such as `KeyboardInterrupt` is raised in a - request handler. Version 0.12 ------------ -Released on December 21st 2016, codename Punsch. +Released 2016-12-21, codename Punsch -- the cli command now responds to `--version`. -- Mimetype guessing and ETag generation for file-like objects in ``send_file`` - has been removed, as per issue ``#104``. (`#1849`_) -- Mimetype guessing in ``send_file`` now fails loudly and doesn't fall back to - ``application/octet-stream``. (`#1988`_) -- Make ``flask.safe_join`` able to join multiple paths like ``os.path.join`` - (`#1730`_). -- Revert a behavior change that made the dev server crash instead of returning - an Internal Server Error (`#2006`_). -- Correctly invoke response handlers for both regular request dispatching as - well as error handlers. -- Disable logger propagation by default for the app logger. -- Add support for range requests in ``send_file``. -- ``app.test_client`` includes preset default environment, which can now be - directly set, instead of per ``client.get``. +- The cli command now responds to ``--version``. +- Mimetype guessing and ETag generation for file-like objects in + ``send_file`` has been removed. :issue:`104`, :pr`1849` +- Mimetype guessing in ``send_file`` now fails loudly and doesn't fall + back to ``application/octet-stream``. :pr:`1988` +- Make ``flask.safe_join`` able to join multiple paths like + ``os.path.join`` :pr:`1730` +- Revert a behavior change that made the dev server crash instead of + returning an Internal Server Error. :pr:`2006` +- Correctly invoke response handlers for both regular request + dispatching as well as error handlers. +- Disable logger propagation by default for the app logger. +- Add support for range requests in ``send_file``. +- ``app.test_client`` includes preset default environment, which can + now be directly set, instead of per ``client.get``. +- Fix crash when running under PyPy3. :pr:`1814` -.. _#1849: https://github.com/pallets/flask/pull/1849 -.. _#1988: https://github.com/pallets/flask/pull/1988 -.. _#1730: https://github.com/pallets/flask/pull/1730 -.. _#2006: https://github.com/pallets/flask/pull/2006 - -Version 0.11.2 --------------- - -Bugfix release, unreleased - -- Fix crash when running under PyPy3. (`#1814`_) - -.. _#1814: https://github.com/pallets/flask/pull/1814 Version 0.11.1 -------------- -Bugfix release, released on June 7th 2016. +Released 2016-06-07 -- Fixed a bug that prevented ``FLASK_APP=foobar/__init__.py`` from working. (`#1872`_) +- Fixed a bug that prevented ``FLASK_APP=foobar/__init__.py`` from + working. :pr:`1872` -.. _#1872: https://github.com/pallets/flask/pull/1872 Version 0.11 ------------ -Released on May 29th 2016, codename Absinthe. +Released 2016-05-29, codename Absinthe -- Added support to serializing top-level arrays to :func:`flask.jsonify`. This - introduces a security risk in ancient browsers. See - :ref:`json-security` for details. -- Added before_render_template signal. -- Added `**kwargs` to :meth:`flask.Test.test_client` to support passing - additional keyword arguments to the constructor of - :attr:`flask.Flask.test_client_class`. -- Added ``SESSION_REFRESH_EACH_REQUEST`` config key that controls the - set-cookie behavior. If set to ``True`` a permanent session will be - refreshed each request and get their lifetime extended, if set to - ``False`` it will only be modified if the session actually modifies. - Non permanent sessions are not affected by this and will always - expire if the browser window closes. -- Made Flask support custom JSON mimetypes for incoming data. -- Added support for returning tuples in the form ``(response, headers)`` - from a view function. -- Added :meth:`flask.Config.from_json`. -- Added :attr:`flask.Flask.config_class`. -- Added :meth:`flask.Config.get_namespace`. -- Templates are no longer automatically reloaded outside of debug mode. This - can be configured with the new ``TEMPLATES_AUTO_RELOAD`` config key. -- Added a workaround for a limitation in Python 3.3's namespace loader. -- Added support for explicit root paths when using Python 3.3's namespace - packages. -- Added :command:`flask` and the ``flask.cli`` module to start the local - debug server through the click CLI system. This is recommended over the old - ``flask.run()`` method as it works faster and more reliable due to a - different design and also replaces ``Flask-Script``. -- Error handlers that match specific classes are now checked first, - thereby allowing catching exceptions that are subclasses of HTTP - exceptions (in ``werkzeug.exceptions``). This makes it possible - for an extension author to create exceptions that will by default - result in the HTTP error of their choosing, but may be caught with - a custom error handler if desired. -- Added :meth:`flask.Config.from_mapping`. -- Flask will now log by default even if debug is disabled. The log format is - now hardcoded but the default log handling can be disabled through the - ``LOGGER_HANDLER_POLICY`` configuration key. -- Removed deprecated module functionality. -- Added the ``EXPLAIN_TEMPLATE_LOADING`` config flag which when enabled will - instruct Flask to explain how it locates templates. This should help - users debug when the wrong templates are loaded. -- Enforce blueprint handling in the order they were registered for template - loading. -- Ported test suite to py.test. -- Deprecated ``request.json`` in favour of ``request.get_json()``. -- Add "pretty" and "compressed" separators definitions in jsonify() method. - Reduces JSON response size when JSONIFY_PRETTYPRINT_REGULAR=False by removing - unnecessary white space included by default after separators. -- JSON responses are now terminated with a newline character, because it is a - convention that UNIX text files end with a newline and some clients don't - deal well when this newline is missing. See - https://github.com/pallets/flask/pull/1262 -- this came up originally as a - part of https://github.com/kennethreitz/httpbin/issues/168 -- The automatically provided ``OPTIONS`` method is now correctly disabled if - the user registered an overriding rule with the lowercase-version - ``options`` (issue ``#1288``). -- ``flask.json.jsonify`` now supports the ``datetime.date`` type (`#1326`_). -- Don't leak exception info of already catched exceptions to context teardown - handlers (`#1393`_). -- Allow custom Jinja environment subclasses (`#1422`_). -- Updated extension dev guidelines. +- Added support to serializing top-level arrays to + :func:`flask.jsonify`. This introduces a security risk in ancient + browsers. See :ref:`json-security` for details. +- Added before_render_template signal. +- Added ``**kwargs`` to :meth:`flask.Test.test_client` to support + passing additional keyword arguments to the constructor of + :attr:`flask.Flask.test_client_class`. +- Added ``SESSION_REFRESH_EACH_REQUEST`` config key that controls the + set-cookie behavior. If set to ``True`` a permanent session will be + refreshed each request and get their lifetime extended, if set to + ``False`` it will only be modified if the session actually modifies. + Non permanent sessions are not affected by this and will always + expire if the browser window closes. +- Made Flask support custom JSON mimetypes for incoming data. +- Added support for returning tuples in the form ``(response, + headers)`` from a view function. +- Added :meth:`flask.Config.from_json`. +- Added :attr:`flask.Flask.config_class`. +- Added :meth:`flask.Config.get_namespace`. +- Templates are no longer automatically reloaded outside of debug + mode. This can be configured with the new ``TEMPLATES_AUTO_RELOAD`` + config key. +- Added a workaround for a limitation in Python 3.3's namespace + loader. +- Added support for explicit root paths when using Python 3.3's + namespace packages. +- Added :command:`flask` and the ``flask.cli`` module to start the + local debug server through the click CLI system. This is recommended + over the old ``flask.run()`` method as it works faster and more + reliable due to a different design and also replaces + ``Flask-Script``. +- Error handlers that match specific classes are now checked first, + thereby allowing catching exceptions that are subclasses of HTTP + exceptions (in ``werkzeug.exceptions``). This makes it possible for + an extension author to create exceptions that will by default result + in the HTTP error of their choosing, but may be caught with a custom + error handler if desired. +- Added :meth:`flask.Config.from_mapping`. +- Flask will now log by default even if debug is disabled. The log + format is now hardcoded but the default log handling can be disabled + through the ``LOGGER_HANDLER_POLICY`` configuration key. +- Removed deprecated module functionality. +- Added the ``EXPLAIN_TEMPLATE_LOADING`` config flag which when + enabled will instruct Flask to explain how it locates templates. + This should help users debug when the wrong templates are loaded. +- Enforce blueprint handling in the order they were registered for + template loading. +- Ported test suite to py.test. +- Deprecated ``request.json`` in favour of ``request.get_json()``. +- Add "pretty" and "compressed" separators definitions in jsonify() + method. Reduces JSON response size when + ``JSONIFY_PRETTYPRINT_REGULAR=False`` by removing unnecessary white + space included by default after separators. +- JSON responses are now terminated with a newline character, because + it is a convention that UNIX text files end with a newline and some + clients don't deal well when this newline is missing. This came up + originally as a part of + https://github.com/postmanlabs/httpbin/issues/168. :pr:`1262` +- The automatically provided ``OPTIONS`` method is now correctly + disabled if the user registered an overriding rule with the + lowercase-version ``options``. :issue:`1288` +- ``flask.json.jsonify`` now supports the ``datetime.date`` type. + :pr:`1326` +- Don't leak exception info of already caught exceptions to context + teardown handlers. :pr:`1393` +- Allow custom Jinja environment subclasses. :pr:`1422` +- Updated extension dev guidelines. +- ``flask.g`` now has ``pop()`` and ``setdefault`` methods. +- Turn on autoescape for ``flask.templating.render_template_string`` + by default. :pr:`1515` +- ``flask.ext`` is now deprecated. :pr:`1484` +- ``send_from_directory`` now raises BadRequest if the filename is + invalid on the server OS. :pr:`1763` +- Added the ``JSONIFY_MIMETYPE`` configuration variable. :pr:`1728` +- Exceptions during teardown handling will no longer leave bad + application contexts lingering around. +- Fixed broken ``test_appcontext_signals()`` test case. +- Raise an :exc:`AttributeError` in :func:`flask.helpers.find_package` + with a useful message explaining why it is raised when a PEP 302 + import hook is used without an ``is_package()`` method. +- Fixed an issue causing exceptions raised before entering a request + or app context to be passed to teardown handlers. +- Fixed an issue with query parameters getting removed from requests + in the test client when absolute URLs were requested. +- Made ``@before_first_request`` into a decorator as intended. +- Fixed an etags bug when sending a file streams with a name. +- Fixed ``send_from_directory`` not expanding to the application root + path correctly. +- Changed logic of before first request handlers to flip the flag + after invoking. This will allow some uses that are potentially + dangerous but should probably be permitted. +- Fixed Python 3 bug when a handler from + ``app.url_build_error_handlers`` reraises the ``BuildError``. -- ``flask.g`` now has ``pop()`` and ``setdefault`` methods. -- Turn on autoescape for ``flask.templating.render_template_string`` by default - (`#1515`_). -- ``flask.ext`` is now deprecated (`#1484`_). -- ``send_from_directory`` now raises BadRequest if the filename is invalid on - the server OS (`#1763`_). -- Added the ``JSONIFY_MIMETYPE`` configuration variable (`#1728`_). -- Exceptions during teardown handling will no longer leave bad application - contexts lingering around. - -.. _#1326: https://github.com/pallets/flask/pull/1326 -.. _#1393: https://github.com/pallets/flask/pull/1393 -.. _#1422: https://github.com/pallets/flask/pull/1422 -.. _#1515: https://github.com/pallets/flask/pull/1515 -.. _#1484: https://github.com/pallets/flask/pull/1484 -.. _#1763: https://github.com/pallets/flask/pull/1763 -.. _#1728: https://github.com/pallets/flask/pull/1728 - -Version 0.10.2 --------------- - -(bugfix release, release date to be announced) - -- Fixed broken `test_appcontext_signals()` test case. -- Raise an :exc:`AttributeError` in :func:`flask.helpers.find_package` with a - useful message explaining why it is raised when a PEP 302 import hook is used - without an `is_package()` method. -- Fixed an issue causing exceptions raised before entering a request or app - context to be passed to teardown handlers. -- Fixed an issue with query parameters getting removed from requests in - the test client when absolute URLs were requested. -- Made `@before_first_request` into a decorator as intended. -- Fixed an etags bug when sending a file streams with a name. -- Fixed `send_from_directory` not expanding to the application root path - correctly. -- Changed logic of before first request handlers to flip the flag after - invoking. This will allow some uses that are potentially dangerous but - should probably be permitted. -- Fixed Python 3 bug when a handler from `app.url_build_error_handlers` - reraises the `BuildError`. Version 0.10.1 -------------- -(bugfix release, released on June 14th 2013) +Released 2013-06-14 + +- Fixed an issue where ``|tojson`` was not quoting single quotes which + made the filter not work properly in HTML attributes. Now it's + possible to use that filter in single quoted attributes. This should + make using that filter with angular.js easier. +- Added support for byte strings back to the session system. This + broke compatibility with the common case of people putting binary + data for token verification into the session. +- Fixed an issue where registering the same method twice for the same + endpoint would trigger an exception incorrectly. -- Fixed an issue where ``|tojson`` was not quoting single quotes which - made the filter not work properly in HTML attributes. Now it's - possible to use that filter in single quoted attributes. This should - make using that filter with angular.js easier. -- Added support for byte strings back to the session system. This broke - compatibility with the common case of people putting binary data for - token verification into the session. -- Fixed an issue where registering the same method twice for the same endpoint - would trigger an exception incorrectly. Version 0.10 ------------ -Released on June 13th 2013, codename Limoncello. +Released 2013-06-13, codename Limoncello + +- Changed default cookie serialization format from pickle to JSON to + limit the impact an attacker can do if the secret key leaks. See + :ref:`upgrading-to-010` for more information. +- Added ``template_test`` methods in addition to the already existing + ``template_filter`` method family. +- Added ``template_global`` methods in addition to the already + existing ``template_filter`` method family. +- Set the content-length header for x-sendfile. +- ``tojson`` filter now does not escape script blocks in HTML5 + parsers. +- ``tojson`` used in templates is now safe by default due. This was + allowed due to the different escaping behavior. +- Flask will now raise an error if you attempt to register a new + function on an already used endpoint. +- Added wrapper module around simplejson and added default + serialization of datetime objects. This allows much easier + customization of how JSON is handled by Flask or any Flask + extension. +- Removed deprecated internal ``flask.session`` module alias. Use + ``flask.sessions`` instead to get the session module. This is not to + be confused with ``flask.session`` the session proxy. +- Templates can now be rendered without request context. The behavior + is slightly different as the ``request``, ``session`` and ``g`` + objects will not be available and blueprint's context processors are + not called. +- The config object is now available to the template as a real global + and not through a context processor which makes it available even in + imported templates by default. +- Added an option to generate non-ascii encoded JSON which should + result in less bytes being transmitted over the network. It's + disabled by default to not cause confusion with existing libraries + that might expect ``flask.json.dumps`` to return bytestrings by + default. +- ``flask.g`` is now stored on the app context instead of the request + context. +- ``flask.g`` now gained a ``get()`` method for not erroring out on + non existing items. +- ``flask.g`` now can be used with the ``in`` operator to see what's + defined and it now is iterable and will yield all attributes stored. +- ``flask.Flask.request_globals_class`` got renamed to + ``flask.Flask.app_ctx_globals_class`` which is a better name to what + it does since 0.10. +- ``request``, ``session`` and ``g`` are now also added as proxies to + the template context which makes them available in imported + templates. One has to be very careful with those though because + usage outside of macros might cause caching. +- Flask will no longer invoke the wrong error handlers if a proxy + exception is passed through. +- Added a workaround for chrome's cookies in localhost not working as + intended with domain names. +- Changed logic for picking defaults for cookie values from sessions + to work better with Google Chrome. +- Added ``message_flashed`` signal that simplifies flashing testing. +- Added support for copying of request contexts for better working + with greenlets. +- Removed custom JSON HTTP exception subclasses. If you were relying + on them you can reintroduce them again yourself trivially. Using + them however is strongly discouraged as the interface was flawed. +- Python requirements changed: requiring Python 2.6 or 2.7 now to + prepare for Python 3.3 port. +- Changed how the teardown system is informed about exceptions. This + is now more reliable in case something handles an exception halfway + through the error handling process. +- Request context preservation in debug mode now keeps the exception + information around which means that teardown handlers are able to + distinguish error from success cases. +- Added the ``JSONIFY_PRETTYPRINT_REGULAR`` configuration variable. +- Flask now orders JSON keys by default to not trash HTTP caches due + to different hash seeds between different workers. +- Added ``appcontext_pushed`` and ``appcontext_popped`` signals. +- The builtin run method now takes the ``SERVER_NAME`` into account + when picking the default port to run on. +- Added ``flask.request.get_json()`` as a replacement for the old + ``flask.request.json`` property. -- Changed default cookie serialization format from pickle to JSON to - limit the impact an attacker can do if the secret key leaks. See - :ref:`upgrading-to-010` for more information. -- Added ``template_test`` methods in addition to the already existing - ``template_filter`` method family. -- Added ``template_global`` methods in addition to the already existing - ``template_filter`` method family. -- Set the content-length header for x-sendfile. -- ``tojson`` filter now does not escape script blocks in HTML5 parsers. -- ``tojson`` used in templates is now safe by default due. This was - allowed due to the different escaping behavior. -- Flask will now raise an error if you attempt to register a new function - on an already used endpoint. -- Added wrapper module around simplejson and added default serialization - of datetime objects. This allows much easier customization of how - JSON is handled by Flask or any Flask extension. -- Removed deprecated internal ``flask.session`` module alias. Use - ``flask.sessions`` instead to get the session module. This is not to - be confused with ``flask.session`` the session proxy. -- Templates can now be rendered without request context. The behavior is - slightly different as the ``request``, ``session`` and ``g`` objects - will not be available and blueprint's context processors are not - called. -- The config object is now available to the template as a real global and - not through a context processor which makes it available even in imported - templates by default. -- Added an option to generate non-ascii encoded JSON which should result - in less bytes being transmitted over the network. It's disabled by - default to not cause confusion with existing libraries that might expect - ``flask.json.dumps`` to return bytestrings by default. -- ``flask.g`` is now stored on the app context instead of the request - context. -- ``flask.g`` now gained a ``get()`` method for not erroring out on non - existing items. -- ``flask.g`` now can be used with the ``in`` operator to see what's defined - and it now is iterable and will yield all attributes stored. -- ``flask.Flask.request_globals_class`` got renamed to - ``flask.Flask.app_ctx_globals_class`` which is a better name to what it - does since 0.10. -- `request`, `session` and `g` are now also added as proxies to the template - context which makes them available in imported templates. One has to be - very careful with those though because usage outside of macros might - cause caching. -- Flask will no longer invoke the wrong error handlers if a proxy - exception is passed through. -- Added a workaround for chrome's cookies in localhost not working - as intended with domain names. -- Changed logic for picking defaults for cookie values from sessions - to work better with Google Chrome. -- Added `message_flashed` signal that simplifies flashing testing. -- Added support for copying of request contexts for better working with - greenlets. -- Removed custom JSON HTTP exception subclasses. If you were relying on them - you can reintroduce them again yourself trivially. Using them however is - strongly discouraged as the interface was flawed. -- Python requirements changed: requiring Python 2.6 or 2.7 now to prepare - for Python 3.3 port. -- Changed how the teardown system is informed about exceptions. This is now - more reliable in case something handles an exception halfway through - the error handling process. -- Request context preservation in debug mode now keeps the exception - information around which means that teardown handlers are able to - distinguish error from success cases. -- Added the ``JSONIFY_PRETTYPRINT_REGULAR`` configuration variable. -- Flask now orders JSON keys by default to not trash HTTP caches due to - different hash seeds between different workers. -- Added `appcontext_pushed` and `appcontext_popped` signals. -- The builtin run method now takes the ``SERVER_NAME`` into account when - picking the default port to run on. -- Added `flask.request.get_json()` as a replacement for the old - `flask.request.json` property. Version 0.9 ----------- -Released on July 1st 2012, codename Campari. +Released 2012-07-01, codename Campari + +- The :func:`flask.Request.on_json_loading_failed` now returns a JSON + formatted response by default. +- The :func:`flask.url_for` function now can generate anchors to the + generated links. +- The :func:`flask.url_for` function now can also explicitly generate + URL rules specific to a given HTTP method. +- Logger now only returns the debug log setting if it was not set + explicitly. +- Unregister a circular dependency between the WSGI environment and + the request object when shutting down the request. This means that + environ ``werkzeug.request`` will be ``None`` after the response was + returned to the WSGI server but has the advantage that the garbage + collector is not needed on CPython to tear down the request unless + the user created circular dependencies themselves. +- Session is now stored after callbacks so that if the session payload + is stored in the session you can still modify it in an after request + callback. +- The :class:`flask.Flask` class will avoid importing the provided + import name if it can (the required first parameter), to benefit + tools which build Flask instances programmatically. The Flask class + will fall back to using import on systems with custom module hooks, + e.g. Google App Engine, or when the import name is inside a zip + archive (usually a .egg) prior to Python 2.7. +- Blueprints now have a decorator to add custom template filters + application wide, :meth:`flask.Blueprint.app_template_filter`. +- The Flask and Blueprint classes now have a non-decorator method for + adding custom template filters application wide, + :meth:`flask.Flask.add_template_filter` and + :meth:`flask.Blueprint.add_app_template_filter`. +- The :func:`flask.get_flashed_messages` function now allows rendering + flashed message categories in separate blocks, through a + ``category_filter`` argument. +- The :meth:`flask.Flask.run` method now accepts ``None`` for ``host`` + and ``port`` arguments, using default values when ``None``. This + allows for calling run using configuration values, e.g. + ``app.run(app.config.get('MYHOST'), app.config.get('MYPORT'))``, + with proper behavior whether or not a config file is provided. +- The :meth:`flask.render_template` method now accepts a either an + iterable of template names or a single template name. Previously, it + only accepted a single template name. On an iterable, the first + template found is rendered. +- Added :meth:`flask.Flask.app_context` which works very similar to + the request context but only provides access to the current + application. This also adds support for URL generation without an + active request context. +- View functions can now return a tuple with the first instance being + an instance of :class:`flask.Response`. This allows for returning + ``jsonify(error="error msg"), 400`` from a view function. +- :class:`~flask.Flask` and :class:`~flask.Blueprint` now provide a + :meth:`~flask.Flask.get_send_file_max_age` hook for subclasses to + override behavior of serving static files from Flask when using + :meth:`flask.Flask.send_static_file` (used for the default static + file handler) and :func:`~flask.helpers.send_file`. This hook is + provided a filename, which for example allows changing cache + controls by file extension. The default max-age for ``send_file`` + and static files can be configured through a new + ``SEND_FILE_MAX_AGE_DEFAULT`` configuration variable, which is used + in the default ``get_send_file_max_age`` implementation. +- Fixed an assumption in sessions implementation which could break + message flashing on sessions implementations which use external + storage. +- Changed the behavior of tuple return values from functions. They are + no longer arguments to the response object, they now have a defined + meaning. +- Added :attr:`flask.Flask.request_globals_class` to allow a specific + class to be used on creation of the :data:`~flask.g` instance of + each request. +- Added ``required_methods`` attribute to view functions to force-add + methods on registration. +- Added :func:`flask.after_this_request`. +- Added :func:`flask.stream_with_context` and the ability to push + contexts multiple times without producing unexpected behavior. -- The :func:`flask.Request.on_json_loading_failed` now returns a JSON formatted - response by default. -- The :func:`flask.url_for` function now can generate anchors to the - generated links. -- The :func:`flask.url_for` function now can also explicitly generate - URL rules specific to a given HTTP method. -- Logger now only returns the debug log setting if it was not set - explicitly. -- Unregister a circular dependency between the WSGI environment and - the request object when shutting down the request. This means that - environ ``werkzeug.request`` will be ``None`` after the response was - returned to the WSGI server but has the advantage that the garbage - collector is not needed on CPython to tear down the request unless - the user created circular dependencies themselves. -- Session is now stored after callbacks so that if the session payload - is stored in the session you can still modify it in an after - request callback. -- The :class:`flask.Flask` class will avoid importing the provided import name - if it can (the required first parameter), to benefit tools which build Flask - instances programmatically. The Flask class will fall back to using import - on systems with custom module hooks, e.g. Google App Engine, or when the - import name is inside a zip archive (usually a .egg) prior to Python 2.7. -- Blueprints now have a decorator to add custom template filters application - wide, :meth:`flask.Blueprint.app_template_filter`. -- The Flask and Blueprint classes now have a non-decorator method for adding - custom template filters application wide, - :meth:`flask.Flask.add_template_filter` and - :meth:`flask.Blueprint.add_app_template_filter`. -- The :func:`flask.get_flashed_messages` function now allows rendering flashed - message categories in separate blocks, through a ``category_filter`` - argument. -- The :meth:`flask.Flask.run` method now accepts ``None`` for `host` and `port` - arguments, using default values when ``None``. This allows for calling run - using configuration values, e.g. ``app.run(app.config.get('MYHOST'), - app.config.get('MYPORT'))``, with proper behavior whether or not a config - file is provided. -- The :meth:`flask.render_template` method now accepts a either an iterable of - template names or a single template name. Previously, it only accepted a - single template name. On an iterable, the first template found is rendered. -- Added :meth:`flask.Flask.app_context` which works very similar to the - request context but only provides access to the current application. This - also adds support for URL generation without an active request context. -- View functions can now return a tuple with the first instance being an - instance of :class:`flask.Response`. This allows for returning - ``jsonify(error="error msg"), 400`` from a view function. -- :class:`~flask.Flask` and :class:`~flask.Blueprint` now provide a - :meth:`~flask.Flask.get_send_file_max_age` hook for subclasses to override - behavior of serving static files from Flask when using - :meth:`flask.Flask.send_static_file` (used for the default static file - handler) and :func:`~flask.helpers.send_file`. This hook is provided a - filename, which for example allows changing cache controls by file extension. - The default max-age for `send_file` and static files can be configured - through a new ``SEND_FILE_MAX_AGE_DEFAULT`` configuration variable, which is - used in the default `get_send_file_max_age` implementation. -- Fixed an assumption in sessions implementation which could break message - flashing on sessions implementations which use external storage. -- Changed the behavior of tuple return values from functions. They are no - longer arguments to the response object, they now have a defined meaning. -- Added :attr:`flask.Flask.request_globals_class` to allow a specific class to - be used on creation of the :data:`~flask.g` instance of each request. -- Added `required_methods` attribute to view functions to force-add methods - on registration. -- Added :func:`flask.after_this_request`. -- Added :func:`flask.stream_with_context` and the ability to push contexts - multiple times without producing unexpected behavior. Version 0.8.1 ------------- -Bugfix release, released on July 1st 2012 +Released 2012-07-01 + +- Fixed an issue with the undocumented ``flask.session`` module to not + work properly on Python 2.5. It should not be used but did cause + some problems for package managers. -- Fixed an issue with the undocumented `flask.session` module to not - work properly on Python 2.5. It should not be used but did cause - some problems for package managers. Version 0.8 ----------- -Released on September 29th 2011, codename Rakija +Released 2011-09-29, codename Rakija -- Refactored session support into a session interface so that - the implementation of the sessions can be changed without - having to override the Flask class. -- Empty session cookies are now deleted properly automatically. -- View functions can now opt out of getting the automatic - OPTIONS implementation. -- HTTP exceptions and Bad Request errors can now be trapped so that they - show up normally in the traceback. -- Flask in debug mode is now detecting some common problems and tries to - warn you about them. -- Flask in debug mode will now complain with an assertion error if a view - was attached after the first request was handled. This gives earlier - feedback when users forget to import view code ahead of time. -- Added the ability to register callbacks that are only triggered once at - the beginning of the first request. (:meth:`Flask.before_first_request`) -- Malformed JSON data will now trigger a bad request HTTP exception instead - of a value error which usually would result in a 500 internal server - error if not handled. This is a backwards incompatible change. -- Applications now not only have a root path where the resources and modules - are located but also an instance path which is the designated place to - drop files that are modified at runtime (uploads etc.). Also this is - conceptually only instance depending and outside version control so it's - the perfect place to put configuration files etc. For more information - see :ref:`instance-folders`. -- Added the ``APPLICATION_ROOT`` configuration variable. -- Implemented :meth:`~flask.testing.TestClient.session_transaction` to - easily modify sessions from the test environment. -- Refactored test client internally. The ``APPLICATION_ROOT`` configuration - variable as well as ``SERVER_NAME`` are now properly used by the test client - as defaults. -- Added :attr:`flask.views.View.decorators` to support simpler decorating of - pluggable (class-based) views. -- Fixed an issue where the test client if used with the "with" statement did not - trigger the execution of the teardown handlers. -- Added finer control over the session cookie parameters. -- HEAD requests to a method view now automatically dispatch to the `get` - method if no handler was implemented. -- Implemented the virtual :mod:`flask.ext` package to import extensions from. -- The context preservation on exceptions is now an integral component of - Flask itself and no longer of the test client. This cleaned up some - internal logic and lowers the odds of runaway request contexts in unittests. +- Refactored session support into a session interface so that the + implementation of the sessions can be changed without having to + override the Flask class. +- Empty session cookies are now deleted properly automatically. +- View functions can now opt out of getting the automatic OPTIONS + implementation. +- HTTP exceptions and Bad Request errors can now be trapped so that + they show up normally in the traceback. +- Flask in debug mode is now detecting some common problems and tries + to warn you about them. +- Flask in debug mode will now complain with an assertion error if a + view was attached after the first request was handled. This gives + earlier feedback when users forget to import view code ahead of + time. +- Added the ability to register callbacks that are only triggered once + at the beginning of the first request. + (:meth:`Flask.before_first_request`) +- Malformed JSON data will now trigger a bad request HTTP exception + instead of a value error which usually would result in a 500 + internal server error if not handled. This is a backwards + incompatible change. +- Applications now not only have a root path where the resources and + modules are located but also an instance path which is the + designated place to drop files that are modified at runtime (uploads + etc.). Also this is conceptually only instance depending and outside + version control so it's the perfect place to put configuration files + etc. For more information see :ref:`instance-folders`. +- Added the ``APPLICATION_ROOT`` configuration variable. +- Implemented :meth:`~flask.testing.TestClient.session_transaction` to + easily modify sessions from the test environment. +- Refactored test client internally. The ``APPLICATION_ROOT`` + configuration variable as well as ``SERVER_NAME`` are now properly + used by the test client as defaults. +- Added :attr:`flask.views.View.decorators` to support simpler + decorating of pluggable (class-based) views. +- Fixed an issue where the test client if used with the "with" + statement did not trigger the execution of the teardown handlers. +- Added finer control over the session cookie parameters. +- HEAD requests to a method view now automatically dispatch to the + ``get`` method if no handler was implemented. +- Implemented the virtual :mod:`flask.ext` package to import + extensions from. +- The context preservation on exceptions is now an integral component + of Flask itself and no longer of the test client. This cleaned up + some internal logic and lowers the odds of runaway request contexts + in unittests. +- Fixed the Jinja2 environment's ``list_templates`` method not + returning the correct names when blueprints or modules were + involved. -Version 0.7.3 -------------- - -Bugfix release, release date to be decided - -- Fixed the Jinja2 environment's list_templates method not returning the - correct names when blueprints or modules were involved. Version 0.7.2 ------------- -Bugfix release, released on July 6th 2011 +Released 2011-07-06 + +- Fixed an issue with URL processors not properly working on + blueprints. -- Fixed an issue with URL processors not properly working on - blueprints. Version 0.7.1 ------------- -Bugfix release, released on June 29th 2011 +Released 2011-06-29 + +- Added missing future import that broke 2.5 compatibility. +- Fixed an infinite redirect issue with blueprints. -- Added missing future import that broke 2.5 compatibility. -- Fixed an infinite redirect issue with blueprints. Version 0.7 ----------- -Released on June 28th 2011, codename Grappa +Released 2011-06-28, codename Grappa + +- Added :meth:`~flask.Flask.make_default_options_response` which can + be used by subclasses to alter the default behavior for ``OPTIONS`` + responses. +- Unbound locals now raise a proper :exc:`RuntimeError` instead of an + :exc:`AttributeError`. +- Mimetype guessing and etag support based on file objects is now + deprecated for :func:`flask.send_file` because it was unreliable. + Pass filenames instead or attach your own etags and provide a proper + mimetype by hand. +- Static file handling for modules now requires the name of the static + folder to be supplied explicitly. The previous autodetection was not + reliable and caused issues on Google's App Engine. Until 1.0 the old + behavior will continue to work but issue dependency warnings. +- Fixed a problem for Flask to run on jython. +- Added a ``PROPAGATE_EXCEPTIONS`` configuration variable that can be + used to flip the setting of exception propagation which previously + was linked to ``DEBUG`` alone and is now linked to either ``DEBUG`` + or ``TESTING``. +- Flask no longer internally depends on rules being added through the + ``add_url_rule`` function and can now also accept regular werkzeug + rules added to the url map. +- Added an ``endpoint`` method to the flask application object which + allows one to register a callback to an arbitrary endpoint with a + decorator. +- Use Last-Modified for static file sending instead of Date which was + incorrectly introduced in 0.6. +- Added ``create_jinja_loader`` to override the loader creation + process. +- Implemented a silent flag for ``config.from_pyfile``. +- Added ``teardown_request`` decorator, for functions that should run + at the end of a request regardless of whether an exception occurred. + Also the behavior for ``after_request`` was changed. It's now no + longer executed when an exception is raised. See + :ref:`upgrading-to-new-teardown-handling` +- Implemented :func:`flask.has_request_context` +- Deprecated ``init_jinja_globals``. Override the + :meth:`~flask.Flask.create_jinja_environment` method instead to + achieve the same functionality. +- Added :func:`flask.safe_join` +- The automatic JSON request data unpacking now looks at the charset + mimetype parameter. +- Don't modify the session on :func:`flask.get_flashed_messages` if + there are no messages in the session. +- ``before_request`` handlers are now able to abort requests with + errors. +- It is not possible to define user exception handlers. That way you + can provide custom error messages from a central hub for certain + errors that might occur during request processing (for instance + database connection errors, timeouts from remote resources etc.). +- Blueprints can provide blueprint specific error handlers. +- Implemented generic :ref:`views` (class-based views). -- Added :meth:`~flask.Flask.make_default_options_response` - which can be used by subclasses to alter the default - behavior for ``OPTIONS`` responses. -- Unbound locals now raise a proper :exc:`RuntimeError` instead - of an :exc:`AttributeError`. -- Mimetype guessing and etag support based on file objects is now - deprecated for :func:`flask.send_file` because it was unreliable. - Pass filenames instead or attach your own etags and provide a - proper mimetype by hand. -- Static file handling for modules now requires the name of the - static folder to be supplied explicitly. The previous autodetection - was not reliable and caused issues on Google's App Engine. Until - 1.0 the old behavior will continue to work but issue dependency - warnings. -- fixed a problem for Flask to run on jython. -- added a ``PROPAGATE_EXCEPTIONS`` configuration variable that can be - used to flip the setting of exception propagation which previously - was linked to ``DEBUG`` alone and is now linked to either ``DEBUG`` or - ``TESTING``. -- Flask no longer internally depends on rules being added through the - `add_url_rule` function and can now also accept regular werkzeug - rules added to the url map. -- Added an `endpoint` method to the flask application object which - allows one to register a callback to an arbitrary endpoint with - a decorator. -- Use Last-Modified for static file sending instead of Date which - was incorrectly introduced in 0.6. -- Added `create_jinja_loader` to override the loader creation process. -- Implemented a silent flag for `config.from_pyfile`. -- Added `teardown_request` decorator, for functions that should run at the end - of a request regardless of whether an exception occurred. Also the behavior - for `after_request` was changed. It's now no longer executed when an exception - is raised. See :ref:`upgrading-to-new-teardown-handling` -- Implemented :func:`flask.has_request_context` -- Deprecated `init_jinja_globals`. Override the - :meth:`~flask.Flask.create_jinja_environment` method instead to - achieve the same functionality. -- Added :func:`flask.safe_join` -- The automatic JSON request data unpacking now looks at the charset - mimetype parameter. -- Don't modify the session on :func:`flask.get_flashed_messages` if there - are no messages in the session. -- `before_request` handlers are now able to abort requests with errors. -- it is not possible to define user exception handlers. That way you can - provide custom error messages from a central hub for certain errors that - might occur during request processing (for instance database connection - errors, timeouts from remote resources etc.). -- Blueprints can provide blueprint specific error handlers. -- Implemented generic :ref:`views` (class-based views). Version 0.6.1 ------------- -Bugfix release, released on December 31st 2010 +Released 2010-12-31 + +- Fixed an issue where the default ``OPTIONS`` response was not + exposing all valid methods in the ``Allow`` header. +- Jinja2 template loading syntax now allows "./" in front of a + template load path. Previously this caused issues with module + setups. +- Fixed an issue where the subdomain setting for modules was ignored + for the static folder. +- Fixed a security problem that allowed clients to download arbitrary + files if the host server was a windows based operating system and + the client uses backslashes to escape the directory the files where + exposed from. -- Fixed an issue where the default ``OPTIONS`` response was - not exposing all valid methods in the ``Allow`` header. -- Jinja2 template loading syntax now allows "./" in front of - a template load path. Previously this caused issues with - module setups. -- Fixed an issue where the subdomain setting for modules was - ignored for the static folder. -- Fixed a security problem that allowed clients to download arbitrary files - if the host server was a windows based operating system and the client - uses backslashes to escape the directory the files where exposed from. Version 0.6 ----------- -Released on July 27th 2010, codename Whisky +Released 2010-07-27, codename Whisky -- after request functions are now called in reverse order of - registration. -- OPTIONS is now automatically implemented by Flask unless the - application explicitly adds 'OPTIONS' as method to the URL rule. - In this case no automatic OPTIONS handling kicks in. -- static rules are now even in place if there is no static folder - for the module. This was implemented to aid GAE which will - remove the static folder if it's part of a mapping in the .yml - file. -- the :attr:`~flask.Flask.config` is now available in the templates - as `config`. -- context processors will no longer override values passed directly - to the render function. -- added the ability to limit the incoming request data with the - new ``MAX_CONTENT_LENGTH`` configuration value. -- the endpoint for the :meth:`flask.Module.add_url_rule` method - is now optional to be consistent with the function of the - same name on the application object. -- added a :func:`flask.make_response` function that simplifies - creating response object instances in views. -- added signalling support based on blinker. This feature is currently - optional and supposed to be used by extensions and applications. If - you want to use it, make sure to have `blinker`_ installed. -- refactored the way URL adapters are created. This process is now - fully customizable with the :meth:`~flask.Flask.create_url_adapter` - method. -- modules can now register for a subdomain instead of just an URL - prefix. This makes it possible to bind a whole module to a - configurable subdomain. +- After request functions are now called in reverse order of + registration. +- OPTIONS is now automatically implemented by Flask unless the + application explicitly adds 'OPTIONS' as method to the URL rule. In + this case no automatic OPTIONS handling kicks in. +- Static rules are now even in place if there is no static folder for + the module. This was implemented to aid GAE which will remove the + static folder if it's part of a mapping in the .yml file. +- The :attr:`~flask.Flask.config` is now available in the templates as + ``config``. +- Context processors will no longer override values passed directly to + the render function. +- Added the ability to limit the incoming request data with the new + ``MAX_CONTENT_LENGTH`` configuration value. +- The endpoint for the :meth:`flask.Module.add_url_rule` method is now + optional to be consistent with the function of the same name on the + application object. +- Added a :func:`flask.make_response` function that simplifies + creating response object instances in views. +- Added signalling support based on blinker. This feature is currently + optional and supposed to be used by extensions and applications. If + you want to use it, make sure to have `blinker`_ installed. +- Refactored the way URL adapters are created. This process is now + fully customizable with the :meth:`~flask.Flask.create_url_adapter` + method. +- Modules can now register for a subdomain instead of just an URL + prefix. This makes it possible to bind a whole module to a + configurable subdomain. .. _blinker: https://pypi.org/project/blinker/ + Version 0.5.2 ------------- -Bugfix Release, released on July 15th 2010 +Released 2010-07-15 + +- Fixed another issue with loading templates from directories when + modules were used. -- fixed another issue with loading templates from directories when - modules were used. Version 0.5.1 ------------- -Bugfix Release, released on July 6th 2010 +Released 2010-07-06 + +- Fixes an issue with template loading from directories when modules + where used. -- fixes an issue with template loading from directories when modules - where used. Version 0.5 ----------- -Released on July 6th 2010, codename Calvados +Released 2010-07-06, codename Calvados + +- Fixed a bug with subdomains that was caused by the inability to + specify the server name. The server name can now be set with the + ``SERVER_NAME`` config key. This key is now also used to set the + session cookie cross-subdomain wide. +- Autoescaping is no longer active for all templates. Instead it is + only active for ``.html``, ``.htm``, ``.xml`` and ``.xhtml``. Inside + templates this behavior can be changed with the ``autoescape`` tag. +- Refactored Flask internally. It now consists of more than a single + file. +- :func:`flask.send_file` now emits etags and has the ability to do + conditional responses builtin. +- (temporarily) dropped support for zipped applications. This was a + rarely used feature and led to some confusing behavior. +- Added support for per-package template and static-file directories. +- Removed support for ``create_jinja_loader`` which is no longer used + in 0.5 due to the improved module support. +- Added a helper function to expose files from any directory. -- fixed a bug with subdomains that was caused by the inability to - specify the server name. The server name can now be set with - the ``SERVER_NAME`` config key. This key is now also used to set - the session cookie cross-subdomain wide. -- autoescaping is no longer active for all templates. Instead it - is only active for ``.html``, ``.htm``, ``.xml`` and ``.xhtml``. - Inside templates this behavior can be changed with the - ``autoescape`` tag. -- refactored Flask internally. It now consists of more than a - single file. -- :func:`flask.send_file` now emits etags and has the ability to - do conditional responses builtin. -- (temporarily) dropped support for zipped applications. This was a - rarely used feature and led to some confusing behavior. -- added support for per-package template and static-file directories. -- removed support for `create_jinja_loader` which is no longer used - in 0.5 due to the improved module support. -- added a helper function to expose files from any directory. Version 0.4 ----------- -Released on June 18th 2010, codename Rakia +Released 2010-06-18, codename Rakia + +- Added the ability to register application wide error handlers from + modules. +- :meth:`~flask.Flask.after_request` handlers are now also invoked if + the request dies with an exception and an error handling page kicks + in. +- Test client has not the ability to preserve the request context for + a little longer. This can also be used to trigger custom requests + that do not pop the request stack for testing. +- Because the Python standard library caches loggers, the name of the + logger is configurable now to better support unittests. +- Added ``TESTING`` switch that can activate unittesting helpers. +- The logger switches to ``DEBUG`` mode now if debug is enabled. -- added the ability to register application wide error handlers - from modules. -- :meth:`~flask.Flask.after_request` handlers are now also invoked - if the request dies with an exception and an error handling page - kicks in. -- test client has the ability to preserve the request context - for a little longer. This can also be used to trigger custom - requests that do not pop the request stack for testing. -- because the Python standard library caches loggers, the name of - the logger is configurable now to better support unittests. -- added ``TESTING`` switch that can activate unittesting helpers. -- the logger switches to ``DEBUG`` mode now if debug is enabled. Version 0.3.1 ------------- -Bugfix release, released on May 28th 2010 +Released 2010-05-28 + +- Fixed a error reporting bug with :meth:`flask.Config.from_envvar` +- Removed some unused code from flask +- Release does no longer include development leftover files (.git + folder for themes, built documentation in zip and pdf file and some + .pyc files) -- fixed a error reporting bug with :meth:`flask.Config.from_envvar` -- removed some unused code from flask -- release does no longer include development leftover files (.git - folder for themes, built documentation in zip and pdf file and - some .pyc files) Version 0.3 ----------- -Released on May 28th 2010, codename Schnaps +Released 2010-05-28, codename Schnaps + +- Added support for categories for flashed messages. +- The application now configures a :class:`logging.Handler` and will + log request handling exceptions to that logger when not in debug + mode. This makes it possible to receive mails on server errors for + example. +- Added support for context binding that does not require the use of + the with statement for playing in the console. +- The request context is now available within the with statement + making it possible to further push the request context or pop it. +- Added support for configurations. -- added support for categories for flashed messages. -- the application now configures a :class:`logging.Handler` and will - log request handling exceptions to that logger when not in debug - mode. This makes it possible to receive mails on server errors - for example. -- added support for context binding that does not require the use of - the with statement for playing in the console. -- the request context is now available within the with statement making - it possible to further push the request context or pop it. -- added support for configurations. Version 0.2 ----------- -Released on May 12th 2010, codename Jägermeister +Released 2010-05-12, codename Jägermeister + +- Various bugfixes +- Integrated JSON support +- Added :func:`~flask.get_template_attribute` helper function. +- :meth:`~flask.Flask.add_url_rule` can now also register a view + function. +- Refactored internal request dispatching. +- Server listens on 127.0.0.1 by default now to fix issues with + chrome. +- Added external URL support. +- Added support for :func:`~flask.send_file` +- Module support and internal request handling refactoring to better + support pluggable applications. +- Sessions can be set to be permanent now on a per-session basis. +- Better error reporting on missing secret keys. +- Added support for Google Appengine. -- various bugfixes -- integrated JSON support -- added :func:`~flask.get_template_attribute` helper function. -- :meth:`~flask.Flask.add_url_rule` can now also register a - view function. -- refactored internal request dispatching. -- server listens on 127.0.0.1 by default now to fix issues with chrome. -- added external URL support. -- added support for :func:`~flask.send_file` -- module support and internal request handling refactoring - to better support pluggable applications. -- sessions can be set to be permanent now on a per-session basis. -- better error reporting on missing secret keys. -- added support for Google Appengine. Version 0.1 ----------- -First public preview release. +Released 2010-04-16 + +- First public preview release. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index f7517a02..80d77164 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -9,7 +9,7 @@ Support questions Please, don't use the issue tracker for this. Use one of the following resources for questions about your own code: -* The ``#get-help`` channel on our Discord chat: https://discord.gg/t6rrQZH +* The ``#get-help`` channel on our Discord chat: https://discordapp.com/invite/t6rrQZH * The IRC channel ``#pocoo`` on FreeNode is linked to Discord, but Discord is preferred. @@ -24,15 +24,15 @@ Reporting issues ---------------- - Describe what you expected to happen. -- If possible, include a `minimal, complete, and verifiable example`_ to help - us identify the issue. This also helps check that the issue is not with your - own code. +- If possible, include a `minimal reproducible example`_ to help us + identify the issue. This also helps check that the issue is not with + your own code. - Describe what actually happened. Include the full traceback if there was an exception. - List your Python, Flask, and Werkzeug versions. If possible, check if this issue is already fixed in the repository. -.. _minimal, complete, and verifiable example: https://stackoverflow.com/help/mcve +.. _minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example Submitting patches ------------------ @@ -85,10 +85,10 @@ First time setup .. _GitHub account: https://github.com/join .. _latest version of git: https://git-scm.com/downloads -.. _username: https://help.github.com/articles/setting-your-username-in-git/ -.. _email: https://help.github.com/articles/setting-your-email-in-git/ +.. _username: https://help.github.com/en/articles/setting-your-username-in-git +.. _email: https://help.github.com/en/articles/setting-your-commit-email-address-in-git .. _Fork: https://github.com/pallets/flask/fork -.. _Clone: https://help.github.com/articles/fork-a-repo/#step-2-create-a-local-clone-of-your-fork +.. _Clone: https://help.github.com/en/articles/fork-a-repo#step-2-create-a-local-clone-of-your-fork Start coding ~~~~~~~~~~~~ @@ -117,7 +117,7 @@ Start coding .. _Black: https://black.readthedocs.io .. _Editor integration: https://black.readthedocs.io/en/stable/editor_integration.html .. _pre-commit: https://pre-commit.com -.. _create a pull request: https://help.github.com/articles/creating-a-pull-request/ +.. _create a pull request: https://help.github.com/en/articles/creating-a-pull-request .. _contributing-testsuite: @@ -166,20 +166,9 @@ Build the docs in the ``docs`` directory using Sphinx:: Open ``_build/html/index.html`` in your browser to view the docs. -Read more about `Sphinx `_. +Read more about `Sphinx `_. -make targets -~~~~~~~~~~~~ - -Flask provides a ``Makefile`` with various shortcuts. They will ensure that -all dependencies are installed. - -- ``make test`` runs the basic test suite with ``pytest`` -- ``make cov`` runs the basic test suite with ``coverage`` -- ``make test-all`` runs the full test suite with ``tox`` -- ``make docs`` builds the HTML documentation - Caution: zero-padded file modes ------------------------------- diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8f9252f4..00000000 --- a/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -Copyright © 2010 by the Pallets team. - -Some rights reserved. - -Redistribution and use in source and binary forms of the software as -well as documentation, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND -CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/LICENSE.rst b/LICENSE.rst new file mode 100644 index 00000000..9d227a0c --- /dev/null +++ b/LICENSE.rst @@ -0,0 +1,28 @@ +Copyright 2010 Pallets + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/MANIFEST.in b/MANIFEST.in index 4cb69870..555022cb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,11 +1,8 @@ -include Makefile CHANGES.rst CONTRIBUTING.rst LICENSE AUTHORS tox.ini - +include CHANGES.rst +include CONTRIBUTING.rst +include tox.ini graft artwork -graft tests -graft examples graft docs - -global-exclude *.py[co] - prune docs/_build -prune docs/_themes +graft examples +graft tests diff --git a/Makefile b/Makefile deleted file mode 100644 index 595b7c36..00000000 --- a/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -.PHONY: all install-dev test coverage cov test-all tox docs release clean-pyc upload-docs ebook - -all: test - -install-dev: - pip install -q -e .[dev] - -test: clean-pyc install-dev - pytest - -coverage: clean-pyc install-dev - coverage run -m pytest - coverage report - coverage html - -cov: coverage - -test-all: install-dev - tox - -tox: test-all - -docs: clean-pyc install-dev - $(MAKE) -C docs html - -release: - python scripts/make-release.py - -clean-pyc: - find . -name '*.pyc' -exec rm -f {} + - find . -name '*.pyo' -exec rm -f {} + - find . -name '*~' -exec rm -f {} + diff --git a/README.rst b/README.rst index b834952b..29aa8a90 100644 --- a/README.rst +++ b/README.rst @@ -32,9 +32,9 @@ A Simple Example app = Flask(__name__) - @app.route('/') + @app.route("/") def hello(): - return 'Hello, World!' + return "Hello, World!" .. code-block:: text @@ -68,12 +68,10 @@ Links * Website: https://www.palletsprojects.com/p/flask/ * Documentation: http://flask.pocoo.org/docs/ -* License: `BSD `_ * Releases: https://pypi.org/project/Flask/ * Code: https://github.com/pallets/flask * Issue tracker: https://github.com/pallets/flask/issues * Test status: https://dev.azure.com/pallets/pallets/_build?definitionId=2 -* Test coverage: https://codecov.io/gh/pallets/flask * Official chat: https://discord.gg/t6rrQZH .. _WSGI: https://wsgi.readthedocs.io diff --git a/artwork/LICENSE b/artwork/LICENSE deleted file mode 100644 index c6df416c..00000000 --- a/artwork/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2010 by Armin Ronacher. - -Some rights reserved. - -This logo or a modified version may be used by anyone to refer to the -Flask project, but does not indicate endorsement by the project. - -Redistribution and use in source (the SVG file) and binary forms (rendered -PNG files etc.) of the image, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice and this list of conditions. - -* The names of the contributors to the Flask software (see AUTHORS) may - not be used to endorse or promote products derived from this software - without specific prior written permission. - -Note: we would appreciate that you make the image a link to -http://flask.pocoo.org/ if you use it on a web page. diff --git a/artwork/LICENSE.rst b/artwork/LICENSE.rst new file mode 100644 index 00000000..605e41cb --- /dev/null +++ b/artwork/LICENSE.rst @@ -0,0 +1,19 @@ +Copyright 2010 Pallets + +This logo or a modified version may be used by anyone to refer to the +Flask project, but does not indicate endorsement by the project. + +Redistribution and use in source (SVG) and binary (renders in PNG, etc.) +forms, with or without modification, are permitted provided that the +following conditions are met: + +1. Redistributions of source code must retain the above copyright + notice and this list of conditions. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +We would appreciate that you make the image a link to +https://palletsprojects.com/p/flask/ if you use it in a medium that +supports links. diff --git a/docs/Makefile b/docs/Makefile index 23de2666..51285967 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,7 +4,6 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = Flask SOURCEDIR = . BUILDDIR = _build diff --git a/docs/_static/flask-icon.png b/docs/_static/flask-icon.png index ef151f15..55cb8478 100644 Binary files a/docs/_static/flask-icon.png and b/docs/_static/flask-icon.png differ diff --git a/docs/_static/flask-logo-sidebar.png b/docs/_static/flask-logo-sidebar.png deleted file mode 100644 index 55cb8478..00000000 Binary files a/docs/_static/flask-logo-sidebar.png and /dev/null differ diff --git a/docs/api.rst b/docs/api.rst index f4a97845..7e278fc6 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -43,9 +43,9 @@ Incoming Request Data .. attribute:: base_url .. attribute:: url_root - Provides different ways to look at the current `IRI - `_. Imagine your application is - listening on the following application root:: + Provides different ways to look at the current :rfc:`3987`. + Imagine your application is listening on the following application + root:: http://www.example.com/myapplication diff --git a/docs/becomingbig.rst b/docs/becomingbig.rst index 6b534d64..d23c3acb 100644 --- a/docs/becomingbig.rst +++ b/docs/becomingbig.rst @@ -45,7 +45,7 @@ The :ref:`app-dispatch` chapter shows in detail how to apply middleware. You can introduce WSGI middleware to wrap your Flask instances and introduce fixes and changes at the layer between your Flask application and your HTTP server. Werkzeug includes several `middlewares -`_. +`_. Fork. ----- diff --git a/docs/changelog.rst b/docs/changelog.rst index d9e113ec..218fe333 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1 +1,4 @@ +Changelog +========= + .. include:: ../CHANGES.rst diff --git a/docs/cli.rst b/docs/cli.rst index 211effb2..96c5396f 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -10,7 +10,7 @@ interface, in your virtualenv. Executed from the terminal, this script gives access to built-in, extension, and application-defined commands. The ``--help`` option will give more information about any commands and options. -.. _Click: http://click.pocoo.org/ +.. _Click: https://click.palletsprojects.com/ Application Discovery @@ -272,7 +272,7 @@ Custom Commands The ``flask`` command is implemented using `Click`_. See that project's documentation for full information about writing commands. -This example adds the command ``create_user`` that takes the argument +This example adds the command ``create-user`` that takes the argument ``name``. :: import click @@ -280,14 +280,14 @@ This example adds the command ``create_user`` that takes the argument app = Flask(__name__) - @app.cli.command() - @click.argument('name') + @app.cli.command("create-user") + @click.argument("name") def create_user(name): ... :: - $ flask create_user admin + $ flask create-user admin This example adds the same command, but as ``user create``, a command in a group. This is useful if you want to organize multiple related commands. :: @@ -310,7 +310,6 @@ group. This is useful if you want to organize multiple related commands. :: $ flask user create demo - See :ref:`testing-cli` for an overview of how to test your custom commands. @@ -417,7 +416,7 @@ they are installed. Entry points are specified in :file:`setup.py` :: ) -.. _entry point: https://packaging.python.org/tutorials/distributing-packages/#entry-points +.. _entry point: https://packaging.python.org/tutorials/packaging-projects/#entry-points Inside :file:`flask_my_extension/commands.py` you can then export a Click object:: @@ -486,7 +485,7 @@ script is available. Note that you don't need to set ``FLASK_APP``. :: The ``flask`` command, being separate from your code, does not have this issue and is recommended in most cases. -.. _console script: https://packaging.python.org/tutorials/distributing-packages/#console-scripts +.. _console script: https://packaging.python.org/tutorials/packaging-projects/#console-scripts PyCharm Integration diff --git a/docs/conf.py b/docs/conf.py index e263d01a..9fe9d985 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,13 +1,11 @@ -from __future__ import print_function - from pallets_sphinx_themes import get_version from pallets_sphinx_themes import ProjectLink # Project -------------------------------------------------------------- project = "Flask" -copyright = "2010 Pallets Team" -author = "Pallets Team" +copyright = "2010 Pallets" +author = "Pallets" release, version = get_version("Flask") # General -------------------------------------------------------------- @@ -22,7 +20,7 @@ extensions = [ ] intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), - "werkzeug": ("http://werkzeug.pocoo.org/docs/", None), + "werkzeug": ("https://werkzeug.palletsprojects.com/", None), "click": ("https://click.palletsprojects.com/", None), "jinja": ("http://jinja.pocoo.org/docs/", None), "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None), @@ -46,31 +44,21 @@ html_context = { ] } html_sidebars = { - "index": ["project.html", "localtoc.html", "versions.html", "searchbox.html"], - "**": ["localtoc.html", "relations.html", "versions.html", "searchbox.html"], + "index": ["project.html", "localtoc.html", "searchbox.html"], + "**": ["localtoc.html", "relations.html", "searchbox.html"], } -singlehtml_sidebars = {"index": ["project.html", "versions.html", "localtoc.html"]} +singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]} html_static_path = ["_static"] html_favicon = "_static/flask-icon.png" -html_logo = "_static/flask-logo-sidebar.png" +html_logo = "_static/flask-icon.png" html_title = "Flask Documentation ({})".format(version) html_show_sourcelink = False -html_domain_indices = False # LaTeX ---------------------------------------------------------------- latex_documents = [ (master_doc, "Flask-{}.tex".format(version), html_title, author, "manual") ] -latex_use_modindex = False -latex_elements = { - "papersize": "a4paper", - "pointsize": "12pt", - "fontpkg": r"\usepackage{mathpazo}", - "preamble": r"\usepackage{flaskstyle}", -} -latex_use_parts = True -latex_additional_files = ["flaskstyle.sty", "logo.pdf"] # Local Extensions ----------------------------------------------------- diff --git a/docs/contents.rst.inc b/docs/contents.rst.inc deleted file mode 100644 index f76b1591..00000000 --- a/docs/contents.rst.inc +++ /dev/null @@ -1,62 +0,0 @@ -User's Guide ------------- - -This part of the documentation, which is mostly prose, begins with some -background information about Flask, then focuses on step-by-step -instructions for web development with Flask. - -.. toctree:: - :maxdepth: 2 - - foreword - advanced_foreword - installation - quickstart - tutorial/index - templating - testing - errorhandling - logging - config - signals - views - appcontext - reqcontext - blueprints - extensions - cli - server - shell - patterns/index - deploying/index - becomingbig - -API Reference -------------- - -If you are looking for information on a specific function, class or -method, this part of the documentation is for you. - -.. toctree:: - :maxdepth: 2 - - api - -Additional Notes ----------------- - -Design notes, legal information and changelog are here for the interested. - -.. toctree:: - :maxdepth: 2 - - design - htmlfaq - security - unicode - extensiondev - styleguide - upgrading - changelog - license - contributing diff --git a/docs/deploying/cgi.rst b/docs/deploying/cgi.rst index e6c768b4..4c1cdfbf 100644 --- a/docs/deploying/cgi.rst +++ b/docs/deploying/cgi.rst @@ -58,4 +58,4 @@ won't work in that case: For more information consult the documentation of your webserver. -.. _App Engine: https://developers.google.com/appengine/ +.. _App Engine: https://cloud.google.com/appengine/docs/ diff --git a/docs/deploying/index.rst b/docs/deploying/index.rst index edf5a256..5e98f98c 100644 --- a/docs/deploying/index.rst +++ b/docs/deploying/index.rst @@ -17,12 +17,9 @@ Hosted options -------------- - `Deploying Flask on Heroku `_ -- `Deploying Flask on OpenShift `_ -- `Deploying Flask on Webfaction `_ - `Deploying Flask on Google App Engine `_ - `Deploying Flask on AWS Elastic Beanstalk `_ -- `Sharing your Localhost Server with Localtunnel `_ -- `Deploying on Azure (IIS) `_ +- `Deploying on Azure (IIS) `_ - `Deploying on PythonAnywhere `_ Self-hosted options diff --git a/docs/deploying/uwsgi.rst b/docs/deploying/uwsgi.rst index dd0f315d..cbbf00aa 100644 --- a/docs/deploying/uwsgi.rst +++ b/docs/deploying/uwsgi.rst @@ -70,4 +70,4 @@ to have it in the URL root its a bit simpler:: .. _nginx: https://nginx.org/ .. _lighttpd: https://www.lighttpd.net/ .. _cherokee: http://cherokee-project.com/ -.. _uwsgi: https://uwsgi-docs.readthedocs.io/ +.. _uwsgi: https://uwsgi-docs.readthedocs.io/en/latest/ diff --git a/docs/deploying/wsgi-standalone.rst b/docs/deploying/wsgi-standalone.rst index 3b2f9ed9..6614928b 100644 --- a/docs/deploying/wsgi-standalone.rst +++ b/docs/deploying/wsgi-standalone.rst @@ -85,7 +85,7 @@ application from ``myproject``:: $ twistd -n web --port tcp:8080 --wsgi myproject.app -.. _Twisted: https://twistedmatrix.com/ +.. _Twisted: https://twistedmatrix.com/trac/ .. _Twisted Web: https://twistedmatrix.com/trac/wiki/TwistedWeb .. _deploying-proxy-setups: diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index 95a70ba2..a7b16062 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -4,9 +4,8 @@ Flask Extension Development =========================== Flask, being a microframework, often requires some repetitive steps to get -a third party library working. Because very often these steps could be -abstracted to support multiple projects the `Flask Extension Registry`_ -was created. +a third party library working. Many such extensions are already available +on `PyPI `_. If you want to create your own Flask extension for something that does not exist yet, this guide to extension development will help you get your @@ -328,8 +327,8 @@ extension to be approved you have to follow these guidelines: 6. Approved extensions must define all their dependencies in the :file:`setup.py` file unless a dependency cannot be met because it is not available on PyPI. -7. The documentation must use the ``flask`` theme from the `Official - Pallets Themes`_. +7. The documentation must use the ``flask`` theme from the + `Official Pallets Themes`_. 8. The setup.py description (and thus the PyPI description) has to link to the documentation, website (if there is one) and there must be a link to automatically install the development version @@ -342,4 +341,4 @@ extension to be approved you have to follow these guidelines: .. _OAuth extension: https://pythonhosted.org/Flask-OAuth/ .. _mailinglist: http://flask.pocoo.org/mailinglist/ .. _IRC channel: http://flask.pocoo.org/community/irc/ -.. _Official Pallets Themes: https://pypi.org/project/pallets-sphinx-themes/ +.. _Official Pallets Themes: https://pypi.org/project/Pallets-Sphinx-Themes/ diff --git a/docs/flaskstyle.sty b/docs/flaskstyle.sty deleted file mode 100644 index 0c4817ed..00000000 --- a/docs/flaskstyle.sty +++ /dev/null @@ -1,124 +0,0 @@ -\definecolor{TitleColor}{rgb}{0,0,0} -\definecolor{InnerLinkColor}{rgb}{0,0,0} - -% Replace Unicode character 'PARTY POPPER' (U+1F389) with a non-breaking space. -% pdfLaTeX doesn't support Unicode. -\DeclareUnicodeCharacter{1F389}{\nobreakspace} - -\renewcommand{\maketitle}{% - \begin{titlepage}% - \let\footnotesize\small - \let\footnoterule\relax - % Apply following fix only on PDF output, i.e. pdfoutput macro is not - % undefined - \ifx\pdfoutput\undefined\else - \begingroup - % This \def is required to deal with multi-line authors; it - % changes \\ to ', ' (comma-space), making it pass muster for - % generating document info in the PDF file. - \def\\{, } - \pdfinfo{ - /Author (\@author) - /Title (\@title) - } - \endgroup - \fi - \begin{flushright}% - %\sphinxlogo% - {\center - \vspace*{3cm} - \includegraphics{logo.pdf} - \vspace{3cm} - \par - {\rm\Huge \@title \par}% - {\em\LARGE \py@release\releaseinfo \par} - {\large - \@date \par - \py@authoraddress \par - }}% - \end{flushright}%\par - \@thanks - \end{titlepage}% - \cleardoublepage% - \setcounter{footnote}{0}% - \let\thanks\relax\let\maketitle\relax - %\gdef\@thanks{}\gdef\@author{}\gdef\@title{} -} - -\fancypagestyle{normal}{ - \fancyhf{} - \fancyfoot[LE,RO]{{\thepage}} - \fancyfoot[LO]{{\nouppercase{\rightmark}}} - \fancyfoot[RE]{{\nouppercase{\leftmark}}} - \fancyhead[LE,RO]{{ \@title, \py@release}} - \renewcommand{\headrulewidth}{0.4pt} - \renewcommand{\footrulewidth}{0.4pt} -} - -\fancypagestyle{plain}{ - \fancyhf{} - \fancyfoot[LE,RO]{{\thepage}} - \renewcommand{\headrulewidth}{0pt} - \renewcommand{\footrulewidth}{0.4pt} -} - -\titleformat{\section}{\Large}% - {\py@TitleColor\thesection}{0.5em}{\py@TitleColor}{\py@NormalColor} -\titleformat{\subsection}{\large}% - {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor} -\titleformat{\subsubsection}{}% - {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor} -\titleformat{\paragraph}{\large}% - {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor} - -\ChNameVar{\raggedleft\normalsize} -\ChNumVar{\raggedleft \bfseries\Large} -\ChTitleVar{\raggedleft \rm\Huge} - -\renewcommand\thepart{\@Roman\c@part} -\renewcommand\part{% - \pagestyle{plain} - \if@noskipsec \leavevmode \fi - \cleardoublepage - \vspace*{6cm}% - \@afterindentfalse - \secdef\@part\@spart} - -\def\@part[#1]#2{% - \ifnum \c@secnumdepth >\m@ne - \refstepcounter{part}% - \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% - \else - \addcontentsline{toc}{part}{#1}% - \fi - {\parindent \z@ %\center - \interlinepenalty \@M - \normalfont - \ifnum \c@secnumdepth >\m@ne - \rm\Large \partname~\thepart - \par\nobreak - \fi - \MakeUppercase{\rm\Huge #2}% - \markboth{}{}\par}% - \nobreak - \vskip 8ex - \@afterheading} -\def\@spart#1{% - {\parindent \z@ %\center - \interlinepenalty \@M - \normalfont - \huge \bfseries #1\par}% - \nobreak - \vskip 3ex - \@afterheading} - -% use inconsolata font -\usepackage{inconsolata} - -% fix single quotes, for inconsolata. (does not work) -%%\usepackage{textcomp} -%%\begingroup -%% \catcode`'=\active -%% \g@addto@macro\@noligs{\let'\textsinglequote} -%% \endgroup -%%\endinput diff --git a/docs/htmlfaq.rst b/docs/htmlfaq.rst index 37075381..056ecc7d 100644 --- a/docs/htmlfaq.rst +++ b/docs/htmlfaq.rst @@ -186,7 +186,7 @@ Many other features have been added, as well. A good guide to new features in HTML5 is Mark Pilgrim's soon-to-be-published book, `Dive Into HTML5`_. Not all of them are supported in browsers yet, however, so use caution. -.. _Dive Into HTML5: http://diveintohtml5.info/table-of-contents.html +.. _Dive Into HTML5: https://diveintohtml5.info/ What should be used? -------------------- diff --git a/docs/index.rst b/docs/index.rst index 9f40dee7..e768da3e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -21,9 +21,73 @@ Flask depends on the `Jinja`_ template engine and the `Werkzeug`_ WSGI toolkit. The documentation for these libraries can be found at: - `Jinja documentation `_ -- `Werkzeug documentation `_ +- `Werkzeug documentation `_ .. _Jinja: https://www.palletsprojects.com/p/jinja/ .. _Werkzeug: https://www.palletsprojects.com/p/werkzeug/ -.. include:: contents.rst.inc + +User's Guide +------------ + +This part of the documentation, which is mostly prose, begins with some +background information about Flask, then focuses on step-by-step +instructions for web development with Flask. + +.. toctree:: + :maxdepth: 2 + + foreword + advanced_foreword + installation + quickstart + tutorial/index + templating + testing + errorhandling + logging + config + signals + views + appcontext + reqcontext + blueprints + extensions + cli + server + shell + patterns/index + deploying/index + becomingbig + + +API Reference +------------- + +If you are looking for information on a specific function, class or +method, this part of the documentation is for you. + +.. toctree:: + :maxdepth: 2 + + api + + +Additional Notes +---------------- + +Design notes, legal information and changelog are here for the interested. + +.. toctree:: + :maxdepth: 2 + + design + htmlfaq + security + unicode + extensiondev + styleguide + upgrading + changelog + license + contributing diff --git a/docs/installation.rst b/docs/installation.rst index 91df4dcf..d2a6cc16 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -25,11 +25,11 @@ These distributions will be installed automatically when installing Flask. * `Click`_ is a framework for writing command line applications. It provides the ``flask`` command and allows adding custom management commands. -.. _Werkzeug: http://werkzeug.pocoo.org/ -.. _Jinja: http://jinja.pocoo.org/ -.. _MarkupSafe: https://pypi.org/project/MarkupSafe/ -.. _ItsDangerous: https://pythonhosted.org/itsdangerous/ -.. _Click: http://click.pocoo.org/ +.. _Werkzeug: https://palletsprojects.com/p/werkzeug/ +.. _Jinja: https://palletsprojects.com/p/jinja/ +.. _MarkupSafe: https://palletsprojects.com/p/markupsafe/ +.. _ItsDangerous: https://palletsprojects.com/p/itsdangerous/ +.. _Click: https://palletsprojects.com/p/click/ Optional dependencies ~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/latexindex.rst b/docs/latexindex.rst deleted file mode 100644 index 288197c3..00000000 --- a/docs/latexindex.rst +++ /dev/null @@ -1,6 +0,0 @@ -:orphan: - -Flask Documentation -=================== - -.. include:: contents.rst.inc diff --git a/docs/license.rst b/docs/license.rst index 696ee676..24c42a91 100644 --- a/docs/license.rst +++ b/docs/license.rst @@ -1,48 +1,19 @@ License ======= -Flask is licensed under a three clause BSD License. It basically means: -do whatever you want with it as long as the copyright in Flask sticks -around, the conditions are not modified and the disclaimer is present. -Furthermore you must not use the names of the authors to promote derivatives -of the software without written consent. +Source License +-------------- -The full license text can be found below (:ref:`flask-license`). For the -documentation and artwork different licenses apply. +This license applies to all files in the Flask repository and source +distribution. This includes Flask's source code, the examples, and +tests, as well as the documentation. -.. _authors: - -Authors -------- - -.. include:: ../AUTHORS - -General License Definitions ---------------------------- - -The following section contains the full license texts for Flask and the -documentation. - -- "AUTHORS" hereby refers to all the authors listed in the - :ref:`authors` section. - -- The ":ref:`flask-license`" applies to all the source code shipped as - part of Flask (Flask itself as well as the examples and the unittests) - as well as documentation. - -- The ":ref:`artwork-license`" applies to the project's Horn-Logo. - -.. _flask-license: - -Flask License -------------- - -.. include:: ../LICENSE +.. include:: ../LICENSE.rst -.. _artwork-license: +Artwork License +--------------- -Flask Artwork License ---------------------- +This license applies to Flask's logo. -.. include:: ../artwork/LICENSE +.. include:: ../artwork/LICENSE.rst diff --git a/docs/logo.pdf b/docs/logo.pdf deleted file mode 100644 index bd820c24..00000000 Binary files a/docs/logo.pdf and /dev/null differ diff --git a/docs/make.bat b/docs/make.bat index 03c21555..7893348a 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,36 +1,35 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build -set SPHINXPROJ=Flask - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.https://www.sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/patterns/appfactories.rst b/docs/patterns/appfactories.rst index d8efba76..28476a40 100644 --- a/docs/patterns/appfactories.rst +++ b/docs/patterns/appfactories.rst @@ -60,7 +60,7 @@ Factories & Extensions It's preferable to create your extensions and app factories so that the extension object does not initially get bound to the application. -Using `Flask-SQLAlchemy `_, +Using `Flask-SQLAlchemy `_, as an example, you should not do something along those lines:: def create_app(config_filename): diff --git a/docs/patterns/errorpages.rst b/docs/patterns/errorpages.rst index 1df9c061..7e43674c 100644 --- a/docs/patterns/errorpages.rst +++ b/docs/patterns/errorpages.rst @@ -97,3 +97,29 @@ An example template might be this:

What you were looking for is just not there.

go somewhere nice {% endblock %} + + +Returning API errors as JSON +---------------------------- + +When using Flask for web APIs, you can use the same techniques as above +to return JSON responses to API errors. :func:`~flask.abort` is called +with a ``description`` parameter. The :meth:`~flask.errorhandler` will +use that as the JSON error message, and set the status code to 404. + +.. code-block:: python + + from flask import abort, jsonify + + @app.errorhandler(404) + def resource_not_found(e): + return jsonify(error=str(e)), 404 + + @app.route("/cheese") + def get_one_cheese(): + resource = get_resource() + + if resource is None: + abort(404, description="Resource not found") + + return jsonify(resource) diff --git a/docs/patterns/jquery.rst b/docs/patterns/jquery.rst index 0032e44e..b0c0287f 100644 --- a/docs/patterns/jquery.rst +++ b/docs/patterns/jquery.rst @@ -27,7 +27,7 @@ to add a script statement to the bottom of your ```` to load jQuery: url_for('static', filename='jquery.js') }}"> Another method is using Google's `AJAX Libraries API -`_ to load jQuery: +`_ to load jQuery: .. sourcecode:: html diff --git a/docs/patterns/sqlalchemy.rst b/docs/patterns/sqlalchemy.rst index 831d54f0..e2dfcc5d 100644 --- a/docs/patterns/sqlalchemy.rst +++ b/docs/patterns/sqlalchemy.rst @@ -22,7 +22,7 @@ if you want to get started quickly. You can download `Flask-SQLAlchemy`_ from `PyPI `_. -.. _Flask-SQLAlchemy: http://flask-sqlalchemy.pocoo.org/ +.. _Flask-SQLAlchemy: https://flask-sqlalchemy.palletsprojects.com/ Declarative diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 8dad6f3c..1a8e17c6 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -69,8 +69,8 @@ This launches a very simple builtin server, which is good enough for testing but probably not what you want to use in production. For deployment options see :ref:`deployment`. -Now head over to `http://127.0.0.1:5000/ `_, and you -should see your hello world greeting. +Now head over to http://127.0.0.1:5000/, and you should see your hello +world greeting. .. _public-server: @@ -167,7 +167,7 @@ Screenshot of the debugger in action: More information on using the debugger can be found in the `Werkzeug documentation`_. -.. _Werkzeug documentation: http://werkzeug.pocoo.org/docs/debug/#using-the-debugger +.. _Werkzeug documentation: https://werkzeug.palletsprojects.com/debug/#using-the-debugger Have another debugger in mind? See :ref:`working-with-debuggers`. @@ -389,7 +389,7 @@ package it's actually inside your package: For templates you can use the full power of Jinja2 templates. Head over to the official `Jinja2 Template Documentation -`_ for more information. +`_ for more information. Here is an example template: @@ -862,9 +862,8 @@ Here are some example log calls:: app.logger.error('An error occurred') The attached :attr:`~flask.Flask.logger` is a standard logging -:class:`~logging.Logger`, so head over to the official `logging -documentation `_ for more -information. +:class:`~logging.Logger`, so head over to the official :mod:`logging` +docs for more information. Read more on :ref:`application-errors`. diff --git a/docs/requirements.txt b/docs/requirements.txt index 6443d592..543ec917 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ -Sphinx~=1.8.0 -Pallets-Sphinx-Themes~=1.1.0 +Sphinx~=2.1.2 +Pallets-Sphinx-Themes~=1.1.4 sphinxcontrib-log-cabinet~=1.0.0 sphinx-issues~=1.2.0 diff --git a/docs/templating.rst b/docs/templating.rst index 290c0054..3fa7a066 100644 --- a/docs/templating.rst +++ b/docs/templating.rst @@ -11,7 +11,7 @@ An extension can depend on Jinja2 being present. This section only gives a very quick introduction into how Jinja2 is integrated into Flask. If you want information on the template engine's syntax itself, head over to the official `Jinja2 Template -Documentation `_ for +Documentation `_ for more information. Jinja Setup diff --git a/docs/testing.rst b/docs/testing.rst index 4f29a0f7..01eef000 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -20,8 +20,7 @@ framework for our tests. You can install it with ``pip``, like so:: $ pip install pytest -.. _pytest: - https://pytest.org +.. _pytest: https://docs.pytest.org/ The Application --------------- @@ -455,5 +454,5 @@ This is useful for testing complex validation rules and custom types. :: context = hello_command.make_context('hello', ['--name', 'flask']) assert context.params['name'] == 'FLASK' -.. _click: http://click.pocoo.org/ -.. _utilities for testing: http://click.pocoo.org/testing +.. _click: https://click.palletsprojects.com/ +.. _utilities for testing: https://click.palletsprojects.com/testing/ diff --git a/docs/tutorial/deploy.rst b/docs/tutorial/deploy.rst index 00706c4a..8c1713be 100644 --- a/docs/tutorial/deploy.rst +++ b/docs/tutorial/deploy.rst @@ -116,6 +116,6 @@ your application. Waitress is just an example, chosen for the tutorial because it supports both Windows and Linux. There are many more WSGI servers and deployment options that you may choose for your project. -.. _Waitress: https://docs.pylonsproject.org/projects/waitress/ +.. _Waitress: https://docs.pylonsproject.org/projects/waitress/en/stable/ Continue to :doc:`next`. diff --git a/docs/tutorial/install.rst b/docs/tutorial/install.rst index c451d8de..3d7d7c60 100644 --- a/docs/tutorial/install.rst +++ b/docs/tutorial/install.rst @@ -70,7 +70,7 @@ files. See the `official packaging guide`_ for another explanation of the files and options used. -.. _official packaging guide: https://packaging.python.org/tutorials/distributing-packages/ +.. _official packaging guide: https://packaging.python.org/tutorials/packaging-projects/ Install the Project diff --git a/docs/unicode.rst b/docs/unicode.rst index f8ab1558..6e5612d2 100644 --- a/docs/unicode.rst +++ b/docs/unicode.rst @@ -6,9 +6,9 @@ text. Not only these libraries, also the majority of web related Python libraries that deal with text. If you don't know Unicode so far, you should probably read `The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets -`_. This part of the -documentation just tries to cover the very basics so that you have a -pleasant experience with Unicode related things. +`_. +This part of the documentation just tries to cover the very basics so +that you have a pleasant experience with Unicode related things. Automatic Conversion -------------------- diff --git a/scripts/make-release.py b/scripts/make-release.py deleted file mode 100755 index d482e291..00000000 --- a/scripts/make-release.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function - -import os -import re -import sys -from datetime import date -from datetime import datetime -from subprocess import PIPE -from subprocess import Popen - -_date_strip_re = re.compile(r"(?<=\d)(st|nd|rd|th)") - - -def parse_changelog(): - with open("CHANGES.rst") as f: - lineiter = iter(f) - for line in lineiter: - match = re.search(r"^Version\s+(.*)", line.strip()) - - if match is None: - continue - - version = match.group(1).strip() - - if next(lineiter).count("-") != len(match.group(0)): - continue - - while 1: - change_info = next(lineiter).strip() - - if change_info: - break - - match = re.search( - r"released on (\w+\s+\d+\w+\s+\d+)(?:, codename (.*))?", - change_info, - flags=re.IGNORECASE, - ) - - if match is None: - continue - - datestr, codename = match.groups() - return version, parse_date(datestr), codename - - -def bump_version(version): - try: - parts = [int(i) for i in version.split(".")] - except ValueError: - fail("Current version is not numeric") - - parts[-1] += 1 - return ".".join(map(str, parts)) - - -def parse_date(string): - string = _date_strip_re.sub("", string) - return datetime.strptime(string, "%B %d %Y") - - -def set_filename_version(filename, version_number, pattern): - changed = [] - - def inject_version(match): - before, old, after = match.groups() - changed.append(True) - return before + version_number + after - - with open(filename) as f: - contents = re.sub( - r"^(\s*%s\s*=\s*')(.+?)(')" % pattern, - inject_version, - f.read(), - flags=re.DOTALL | re.MULTILINE, - ) - - if not changed: - fail("Could not find %s in %s", pattern, filename) - - with open(filename, "w") as f: - f.write(contents) - - -def set_init_version(version): - info("Setting __init__.py version to %s", version) - set_filename_version("flask/__init__.py", version, "__version__") - - -def build(): - cmd = [sys.executable, "setup.py", "sdist", "bdist_wheel"] - Popen(cmd).wait() - - -def fail(message, *args): - print("Error:", message % args, file=sys.stderr) - sys.exit(1) - - -def info(message, *args): - print(message % args, file=sys.stderr) - - -def get_git_tags(): - return set(Popen(["git", "tag"], stdout=PIPE).communicate()[0].splitlines()) - - -def git_is_clean(): - return Popen(["git", "diff", "--quiet"]).wait() == 0 - - -def make_git_commit(message, *args): - message = message % args - Popen(["git", "commit", "-am", message]).wait() - - -def make_git_tag(tag): - info('Tagging "%s"', tag) - Popen(["git", "tag", tag]).wait() - - -def main(): - os.chdir(os.path.join(os.path.dirname(__file__), "..")) - - rv = parse_changelog() - - if rv is None: - fail("Could not parse changelog") - - version, release_date, codename = rv - dev_version = bump_version(version) + ".dev" - - info( - "Releasing %s (codename %s, release date %s)", - version, - codename, - release_date.strftime("%d/%m/%Y"), - ) - tags = get_git_tags() - - if version in tags: - fail('Version "%s" is already tagged', version) - - if release_date.date() != date.today(): - fail("Release date is not today (%s != %s)", release_date.date(), date.today()) - - if not git_is_clean(): - fail("You have uncommitted changes in git") - - try: - import wheel # noqa: F401 - except ImportError: - fail("You need to install the wheel package.") - - set_init_version(version) - make_git_commit("Bump version number to %s", version) - make_git_tag(version) - build() - set_init_version(dev_version) - - -if __name__ == "__main__": - main() diff --git a/setup.cfg b/setup.cfg index 6dbbeee8..dfac8b07 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,14 +1,10 @@ -[aliases] -release = egg_info -Db '' +[metadata] +license_file = LICENSE.rst [bdist_wheel] -universal = 1 - -[metadata] -license_file = LICENSE +universal = true [tool:pytest] -minversion = 3.0 testpaths = tests [coverage:run] @@ -21,7 +17,7 @@ source = source = src/flask .tox/*/lib/python*/site-packages/flask - .tox/pypy/site-packages/flask + .tox/*/site-packages/flask [flake8] # B = bugbear diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index 36e9a72b..fa680a75 --- a/setup.py +++ b/setup.py @@ -1,8 +1,5 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- import io import re -from collections import OrderedDict from setuptools import find_packages from setuptools import setup @@ -11,51 +8,24 @@ with io.open("README.rst", "rt", encoding="utf8") as f: readme = f.read() with io.open("src/flask/__init__.py", "rt", encoding="utf8") as f: - version = re.search(r"__version__ = \"(.*?)\"", f.read()).group(1) + version = re.search(r'__version__ = "(.*?)"', f.read()).group(1) setup( name="Flask", version=version, - url="https://www.palletsprojects.com/p/flask/", - project_urls=OrderedDict( - ( - ("Documentation", "http://flask.pocoo.org/docs/"), - ("Code", "https://github.com/pallets/flask"), - ("Issue tracker", "https://github.com/pallets/flask/issues"), - ) - ), - license="BSD", + url="https://palletsprojects.com/p/flask/", + project_urls={ + "Documentation": "http://flask.palletsprojects.com/", + "Code": "https://github.com/pallets/flask", + "Issue tracker": "https://github.com/pallets/flask/issues", + }, + license="BSD-3-Clause", author="Armin Ronacher", author_email="armin.ronacher@active-4.com", - maintainer="Pallets team", + maintainer="Pallets", maintainer_email="contact@palletsprojects.com", description="A simple framework for building complex web applications.", long_description=readme, - packages=find_packages("src"), - package_dir={"": "src"}, - include_package_data=True, - zip_safe=False, - platforms="any", - python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", - install_requires=[ - "Werkzeug>=0.15", - "Jinja2>=2.10.1", - "itsdangerous>=0.24", - "click>=5.1", - ], - extras_require={ - "dotenv": ["python-dotenv"], - "dev": [ - "pytest>=3", - "coverage", - "tox", - "sphinx", - "pallets-sphinx-themes", - "sphinxcontrib-log-cabinet", - "pre-commit", - ], - "docs": ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet"], - }, classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", @@ -67,7 +37,6 @@ setup( "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", @@ -76,5 +45,33 @@ setup( "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules", ], + packages=find_packages("src"), + package_dir={"": "src"}, + include_package_data=True, + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", + install_requires=[ + "Werkzeug>=0.15", + "Jinja2>=2.10.1", + "itsdangerous>=0.24", + "click>=5.1", + ], + extras_require={ + "dotenv": ["python-dotenv"], + "dev": [ + "pytest", + "coverage", + "tox", + "sphinx", + "pallets-sphinx-themes", + "sphinxcontrib-log-cabinet", + "sphinx-issues", + ], + "docs": [ + "sphinx", + "pallets-sphinx-themes", + "sphinxcontrib-log-cabinet", + "sphinx-issues", + ], + }, entry_points={"console_scripts": ["flask = flask.cli:main"]}, ) diff --git a/src/flask/__init__.py b/src/flask/__init__.py index 596b0dd3..af12746b 100644 --- a/src/flask/__init__.py +++ b/src/flask/__init__.py @@ -6,8 +6,8 @@ A microframework based on Werkzeug. It's extensively documented and follows best practice patterns. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ # utilities we import from Werkzeug and Jinja2 that are unused # in the module but are exported as public interface. @@ -56,4 +56,4 @@ from .signals import template_rendered from .templating import render_template from .templating import render_template_string -__version__ = "1.1.dev" +__version__ = "1.1.0.dev" diff --git a/src/flask/__main__.py b/src/flask/__main__.py index db25bbd2..f61dbc0b 100644 --- a/src/flask/__main__.py +++ b/src/flask/__main__.py @@ -5,8 +5,8 @@ Alias for flask.run for the command line. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ if __name__ == "__main__": diff --git a/src/flask/_compat.py b/src/flask/_compat.py index dfbb0cda..ee47d821 100644 --- a/src/flask/_compat.py +++ b/src/flask/_compat.py @@ -7,8 +7,8 @@ version of six so we don't have to depend on a specific version of it. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import sys diff --git a/src/flask/app.py b/src/flask/app.py index 503810e8..878f7756 100644 --- a/src/flask/app.py +++ b/src/flask/app.py @@ -5,8 +5,8 @@ This module implements the central WSGI application object. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import os import sys @@ -1332,7 +1332,13 @@ class Flask(_PackageBoundObject): @staticmethod def _get_exc_class_and_code(exc_class_or_code): - """Ensure that we register only exceptions as handler keys""" + """Get the exception class being handled. For HTTP status codes + or ``HTTPException`` subclasses, return both the exception and + status code. + + :param exc_class_or_code: Any exception class, or an HTTP status + code as an integer. + """ if isinstance(exc_class_or_code, integer_types): exc_class = default_exceptions[exc_class_or_code] else: diff --git a/src/flask/blueprints.py b/src/flask/blueprints.py index a6eac6f3..8978104d 100644 --- a/src/flask/blueprints.py +++ b/src/flask/blueprints.py @@ -6,8 +6,8 @@ Blueprints are the recommended way to implement larger or more pluggable applications in Flask 0.7 and later. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ from functools import update_wrapper @@ -88,11 +88,20 @@ class BlueprintSetupState(object): class Blueprint(_PackageBoundObject): - """Represents a blueprint. A blueprint is an object that records - functions that will be called with the - :class:`~flask.blueprints.BlueprintSetupState` later to register functions - or other things on the main application. See :ref:`blueprints` for more - information. + """Represents a blueprint, a collection of routes and other + app-related functions that can be registered on a real application + later. + + A blueprint is an object that allows defining application functions + without requiring an application object ahead of time. It uses the + same decorators as :class:`~flask.Flask`, but defers the need for an + application by recording them for later registration. + + Decorating a function with a blueprint creates a deferred function + that is called with :class:`~flask.blueprints.BlueprintSetupState` + when the blueprint is registered on an application. + + See :ref:`blueprints` for more information. .. versionchanged:: 1.1.0 Blueprints have a ``cli`` group to register nested CLI commands. @@ -100,6 +109,35 @@ class Blueprint(_PackageBoundObject): the ``flask`` command. .. versionadded:: 0.7 + + :param name: The name of the blueprint. Will be prepended to each + endpoint name. + :param import_name: The name of the blueprint package, usually + ``__name__``. This helps locate the ``root_path`` for the + blueprint. + :param static_folder: A folder with static files that should be + served by the blueprint's static route. The path is relative to + the blueprint's root path. Blueprint static files are disabled + by default. + :param static_url_path: The url to serve static files from. + Defaults to ``static_folder``. If the blueprint does not have + a ``url_prefix``, the app's static route will take precedence, + and the blueprint's static files won't be accessible. + :param template_folder: A folder with templates that should be added + to the app's template search path. The path is relative to the + blueprint's root path. Blueprint templates are disabled by + default. Blueprint templates have a lower precedence than those + in the app's templates folder. + :param url_prefix: A path to prepend to all of the blueprint's URLs, + to make them distinct from the rest of the app's routes. + :param subdomain: A subdomain that blueprint routes will match on by + default. + :param url_defaults: A dict of default values that blueprint routes + will receive by default. + :param root_path: By default, the blueprint will automatically this + based on ``import_name``. In certain situations this automatic + detection can fail, so the path can be specified manually + instead. """ warn_on_modifications = False diff --git a/src/flask/cli.py b/src/flask/cli.py index 6f0866ce..b09e66d6 100644 --- a/src/flask/cli.py +++ b/src/flask/cli.py @@ -5,8 +5,8 @@ A simple command line application to run flask apps. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ from __future__ import print_function diff --git a/src/flask/config.py b/src/flask/config.py index 88722a8c..809de336 100644 --- a/src/flask/config.py +++ b/src/flask/config.py @@ -5,8 +5,8 @@ Implements the configuration related objects. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import errno import os diff --git a/src/flask/ctx.py b/src/flask/ctx.py index a2944628..172f6a01 100644 --- a/src/flask/ctx.py +++ b/src/flask/ctx.py @@ -5,8 +5,8 @@ Implements the objects required to keep the context. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import sys from functools import update_wrapper diff --git a/src/flask/debughelpers.py b/src/flask/debughelpers.py index 04c11620..e475bd1a 100644 --- a/src/flask/debughelpers.py +++ b/src/flask/debughelpers.py @@ -5,8 +5,8 @@ Various helpers to make the development experience better. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import os from warnings import warn diff --git a/src/flask/globals.py b/src/flask/globals.py index 783bbed3..6d32dcfd 100644 --- a/src/flask/globals.py +++ b/src/flask/globals.py @@ -6,8 +6,8 @@ Defines all the global objects that are proxies to the current active context. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ from functools import partial diff --git a/src/flask/helpers.py b/src/flask/helpers.py index b5ed62e0..1ae54816 100644 --- a/src/flask/helpers.py +++ b/src/flask/helpers.py @@ -5,8 +5,8 @@ Implements various helpers. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import io import mimetypes diff --git a/src/flask/json/__init__.py b/src/flask/json/__init__.py index 073d3cb2..a141068b 100644 --- a/src/flask/json/__init__.py +++ b/src/flask/json/__init__.py @@ -3,8 +3,8 @@ flask.json ~~~~~~~~~~ -:copyright: © 2010 by the Pallets team. -:license: BSD, see LICENSE for more details. +:copyright: 2010 Pallets +:license: BSD-3-Clause """ import codecs import io diff --git a/src/flask/json/tag.py b/src/flask/json/tag.py index 4eb402e2..5f338d95 100644 --- a/src/flask/json/tag.py +++ b/src/flask/json/tag.py @@ -38,8 +38,8 @@ processes dicts first, so insert the new tag at the front of the order since app.session_interface.serializer.register(TagOrderedDict, index=0) -:copyright: © 2010 by the Pallets team. -:license: BSD, see LICENSE for more details. +:copyright: 2010 Pallets +:license: BSD-3-Clause """ from base64 import b64decode from base64 import b64encode diff --git a/src/flask/logging.py b/src/flask/logging.py index 9ba3415f..dde0b8a7 100644 --- a/src/flask/logging.py +++ b/src/flask/logging.py @@ -3,8 +3,8 @@ flask.logging ~~~~~~~~~~~~~ -:copyright: © 2010 by the Pallets team. -:license: BSD, see LICENSE for more details. +:copyright: 2010 Pallets +:license: BSD-3-Clause """ from __future__ import absolute_import diff --git a/src/flask/sessions.py b/src/flask/sessions.py index 44138fef..c57ba29c 100644 --- a/src/flask/sessions.py +++ b/src/flask/sessions.py @@ -5,8 +5,8 @@ Implements cookie based sessions based on itsdangerous. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import hashlib import warnings diff --git a/src/flask/signals.py b/src/flask/signals.py index 30ee22bd..a2239775 100644 --- a/src/flask/signals.py +++ b/src/flask/signals.py @@ -6,8 +6,8 @@ Implements signals based on blinker if available, otherwise falls silently back to a noop. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ try: from blinker import Namespace diff --git a/src/flask/templating.py b/src/flask/templating.py index 2a305f56..5aeacac7 100644 --- a/src/flask/templating.py +++ b/src/flask/templating.py @@ -5,8 +5,8 @@ Implements the bridge to Jinja2. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ from jinja2 import BaseLoader from jinja2 import Environment as BaseEnvironment diff --git a/src/flask/testing.py b/src/flask/testing.py index 354891e3..b27dfcca 100644 --- a/src/flask/testing.py +++ b/src/flask/testing.py @@ -6,8 +6,8 @@ Implements test support helpers. This module is lazily imported and usually not used in production environments. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import warnings from contextlib import contextmanager diff --git a/src/flask/views.py b/src/flask/views.py index c8da63cd..b3f90768 100644 --- a/src/flask/views.py +++ b/src/flask/views.py @@ -5,8 +5,8 @@ This module provides class-based views inspired by the ones in Django. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ from ._compat import with_metaclass from .globals import request diff --git a/src/flask/wrappers.py b/src/flask/wrappers.py index a22099b8..ac164494 100644 --- a/src/flask/wrappers.py +++ b/src/flask/wrappers.py @@ -5,8 +5,8 @@ Implements the WSGI wrappers (request and response). - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ from werkzeug.exceptions import BadRequest from werkzeug.wrappers import Request as RequestBase diff --git a/tests/conftest.py b/tests/conftest.py index 0ba687d5..8533198a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,8 +3,8 @@ tests.conftest ~~~~~~~~~~~~~~ - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import os import pkgutil diff --git a/tests/test_appctx.py b/tests/test_appctx.py index ae4f131d..bc9de087 100644 --- a/tests/test_appctx.py +++ b/tests/test_appctx.py @@ -5,8 +5,8 @@ Tests the application context. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import pytest diff --git a/tests/test_basic.py b/tests/test_basic.py index 37e8d5c4..b46a7908 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -5,8 +5,8 @@ The basic functionality. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import re import sys diff --git a/tests/test_blueprints.py b/tests/test_blueprints.py index c2e18a3a..6a5e333b 100644 --- a/tests/test_blueprints.py +++ b/tests/test_blueprints.py @@ -5,8 +5,8 @@ Blueprints (and currently modules) - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import functools diff --git a/tests/test_cli.py b/tests/test_cli.py index 5cbe09b7..add45856 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -3,8 +3,8 @@ tests.test_cli ~~~~~~~~~~~~~~ - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ # This file was part of Flask-CLI and was modified under the terms of # its Revised BSD License. Copyright © 2015 CERN. diff --git a/tests/test_config.py b/tests/test_config.py index ee3555c2..be40f379 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -3,8 +3,8 @@ tests.test_config ~~~~~~~~~~~~~~~~~ - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import os import textwrap diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 2b7c776f..01fb4c34 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -5,8 +5,8 @@ Various helpers. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import datetime import io diff --git a/tests/test_instance_config.py b/tests/test_instance_config.py index 2499fcbb..809584ad 100644 --- a/tests/test_instance_config.py +++ b/tests/test_instance_config.py @@ -3,8 +3,8 @@ tests.test_instance ~~~~~~~~~~~~~~~~~~~ - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import os import sys diff --git a/tests/test_json_tag.py b/tests/test_json_tag.py index 8448945d..b61c83a2 100644 --- a/tests/test_json_tag.py +++ b/tests/test_json_tag.py @@ -3,8 +3,8 @@ tests.test_json_tag ~~~~~~~~~~~~~~~~~~~ -:copyright: © 2010 by the Pallets team. -:license: BSD, see LICENSE for more details. +:copyright: 2010 Pallets +:license: BSD-3-Clause """ from datetime import datetime from uuid import uuid4 diff --git a/tests/test_logging.py b/tests/test_logging.py index 6e094749..a0bd3feb 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -3,8 +3,8 @@ tests.test_logging ~~~~~~~~~~~~~~~~~~~ -:copyright: © 2010 by the Pallets team. -:license: BSD, see LICENSE for more details. +:copyright: 2010 Pallets +:license: BSD-3-Clause """ import logging import sys diff --git a/tests/test_regression.py b/tests/test_regression.py index 33333fd3..d5ec837c 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -5,8 +5,8 @@ Tests regressions. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import gc import sys diff --git a/tests/test_reqctx.py b/tests/test_reqctx.py index 4013528c..90eae9d8 100644 --- a/tests/test_reqctx.py +++ b/tests/test_reqctx.py @@ -5,8 +5,8 @@ Tests the request context. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import pytest diff --git a/tests/test_signals.py b/tests/test_signals.py index 6ec931c0..45fe47af 100644 --- a/tests/test_signals.py +++ b/tests/test_signals.py @@ -5,8 +5,8 @@ Signalling. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import pytest diff --git a/tests/test_subclassing.py b/tests/test_subclassing.py index d823567b..0ac278b5 100644 --- a/tests/test_subclassing.py +++ b/tests/test_subclassing.py @@ -6,8 +6,8 @@ Test that certain behavior of flask can be customized by subclasses. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import flask from flask._compat import StringIO diff --git a/tests/test_templating.py b/tests/test_templating.py index 4f50905f..f7a0f691 100644 --- a/tests/test_templating.py +++ b/tests/test_templating.py @@ -5,8 +5,8 @@ Template functionality - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import logging diff --git a/tests/test_testing.py b/tests/test_testing.py index 1490840c..1928219a 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -5,8 +5,8 @@ Test client and more. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import click import pytest diff --git a/tests/test_user_error_handler.py b/tests/test_user_error_handler.py index 51e99e43..5dca9655 100644 --- a/tests/test_user_error_handler.py +++ b/tests/test_user_error_handler.py @@ -3,8 +3,8 @@ tests.test_user_error_handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -:copyright: © 2010 by the Pallets team. -:license: BSD, see LICENSE for more details. +:copyright: 2010 Pallets +:license: BSD-3-Clause """ import pytest from werkzeug.exceptions import Forbidden diff --git a/tests/test_views.py b/tests/test_views.py index e1389f0c..0754669f 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -5,8 +5,8 @@ Pluggable views. - :copyright: © 2010 by the Pallets team. - :license: BSD, see LICENSE for more details. + :copyright: 2010 Pallets + :license: BSD-3-Clause """ import pytest from werkzeug.http import parse_set_header