Commit graph

177 commits

Author SHA1 Message Date
Grey Li
19fb90fd05 Merge remote-tracking branch 'origin/2.0.x' into main 2021-06-26 23:35:24 +08:00
pgjones
e9525a7a16 Fix registering a blueprint twice with differing names
Previously the blueprint recorded aspects (before request, after
request etc) would only be added to the app if it was the first
registration of the blueprint instance. However only the record-once
aspects (app-before requests, app-after request) should be added once
on registration of the instance, whereas everything else should be
added on every unique name registration. This ensures that these
trigger under the new name as well as the old.
2021-06-14 17:18:47 +00:00
pgjones
6e2bd47c59 Improve the changelog entry
The fix to the teardown_request also applies to all teardown_*
methods.
2021-06-06 11:09:03 +01:00
Pascal Corpet
82c2dc4c5c improve typing for app.errorhandler decorator 2021-06-01 19:25:27 +01:00
Miguel Grinberg
ca2788ead6 Support View and MethodView instances with async handlers 2021-06-01 18:08:19 +00:00
Adrian Moennich
84f5e9c19e Merge remote-tracking branch 'upstream/2.0.x' 2021-05-29 20:55:23 +02:00
default-303
6ca89fdfe7 Fix typing of jinja decorators (#4109) 2021-05-29 20:54:35 +02:00
Marat Sharafutdinov
28f4e7464a Fix type annotation for before_request and before_app_request decorators 2021-05-25 18:29:52 +00:00
Pascal Corpet
81c637ff1d improve typing for teardown_request 2021-05-24 19:28:57 +00:00
David Lord
66d6d75d99 Merge branch '2.0.x' 2021-05-21 08:56:18 -07:00
David Lord
af4a5b841e start version 2.0.2.dev0 2021-05-21 08:55:31 -07:00
David Lord
e681adb826 release version 2.0.1 2021-05-21 08:50:31 -07:00
David Lord
d883eb2ab5 improve typing for stream_with_context 2021-05-21 08:42:44 -07:00
David Lord
020ac5f2d9 warn when registering same blueprint with same name 2021-05-21 15:04:30 +01:00
David Lord
4907999188 changelog for blueprint registered name 2021-05-21 15:04:30 +01:00
Alex Hedges
7fb6d79770 Update CHANGES.rst 2021-05-21 08:09:05 +00:00
David Lord
10e22202dd Merge branch '2.0.x' 2021-05-20 21:05:59 -07:00
David Lord
58e5ba2980 re-add deprecated Config.from_json method 2021-05-20 13:50:13 -07:00
David Lord
5eb80d163b Merge pull request #4055 from pallets/converter-session
converters have access to session
2021-05-14 08:17:37 -07:00
David Lord
bd3a8b71f8 converters have access to session 2021-05-14 08:11:09 -07:00
David Lord
7a1d921926 Merge branch '2.0.x' 2021-05-13 18:47:43 -07:00
David Lord
919966dd0e Merge branch '1.1.x' into 2.0.x 2021-05-13 18:47:06 -07:00
David Lord
582339292a release version 1.1.4 2021-05-13 18:22:56 -07:00
brettlangdon
289dad68e8 Use compat fspath instead of os.fspath
When 7ba35c4 was cherry-picked it introduced the
usage of os.fspath which is not supported on
Python <3.6
2021-05-13 18:17:00 -07:00
David Lord
d28759b3d0 Merge branch '2.0.x' 2021-05-13 16:36:10 -07:00
David Lord
5ae521f365 Merge branch '1.1.x' into 2.0.x 2021-05-13 16:34:58 -07:00
David Lord
5d18fbb512 release version 1.1.3 2021-05-13 16:22:57 -07:00
David Lord
7df523231c set maximum versions of pallets dependencies 2021-05-13 16:16:45 -07:00
David Lord
51ad5ed9b9 Merge remote-tracking branch 'origin/2.0.x' 2021-05-13 16:01:23 -07:00
Grey Li
ad15cd639e fix url_prefix argument when nesting blueprints 2021-05-13 15:02:13 -07:00
David Lord
2e3276e3dd blueprint name may not contain a dot 2021-05-13 14:31:50 -07:00
Grey Li
702529eb9c improve type hints for send_file and send_from_directory 2021-05-13 13:33:07 -07:00
David Lord
78519d52e4 fix typing that wasn't available in Python 3.6.0 2021-05-13 13:06:32 -07:00
David Lord
7c738c6fcb inform mypy that g has arbitrary attributes 2021-05-13 13:06:32 -07:00
David Lord
4edf300c40 mark top-level names as exported 2021-05-13 11:36:05 -07:00
Grey Li
811bc1b01c Re-add filename param for send_from_directory
Add a deprecation warning for the old name
2021-05-12 10:15:55 -07:00
David Lord
7bed6e8732 update click minimum version 2021-05-11 14:55:09 -07:00
David Lord
aa11c44e62 start version 2.1.0.dev0 2021-05-11 14:48:48 -07:00
David Lord
269e8782ac start version 2.0.1.dev0 2021-05-11 14:48:08 -07:00
David Lord
a55e2500ab release version 2.0.0 2021-05-11 14:41:52 -07:00
Grey Li
de8fa20fac Update changelog for #3932 2021-04-28 14:20:44 +08:00
Adrian Moennich
d235ab0faa Allow using Click 7 with a DeprecationWarning
As long as popular libraries (e.g. Celery) require click 7, depending
on Click 8 in Flask makes it hard to test the latest version (and its
other dependencies) in existing applications.
2021-04-27 16:45:06 +02:00
David Lord
2394ce4208 Merge pull request #3973 from pgjones/typing 2021-04-27 07:32:10 -07:00
pgjones
fa5c99ef4f Add initial type hints
This should make it easier for users to correctly use Flask. The hints
are from Quart.
2021-04-26 17:29:53 +01:00
David Lord
cba97ff101 changelog for bumped pallets versions 2021-04-24 07:31:16 -07:00
David Lord
96ea4be346 deprecate total_seconds 2021-04-15 23:14:53 -07:00
David Lord
962b55b9b6 shell calls sys.__interativehook__
This will set up readline tab and history completion by default.
2021-04-14 10:01:32 -07:00
pgjones
257c7c5c2a Nested blueprints
This allows blueprints to be nested within blueprints via a new
Blueprint.register_blueprint method. This should provide a use case
that has been desired for the past ~10 years.

This works by setting the endpoint name to be the blueprint names,
from parent to child delimeted by "." and then iterating over the
blueprint names in reverse order in the app (from most specific to
most general). This means that the expectation of nesting a blueprint
within a nested blueprint is met.
2021-04-14 09:25:42 -07:00
pgjones
c9f774d650 Add async support
This allows for async functions to be passed to the Flask class
instance, for example as a view function,

    @app.route("/")
    async def index():
        return "Async hello"

this comes with a cost though of poorer performance than using the
sync equivalent.

asgiref is the standard way to run async code within a sync context,
and is used in Django making it a safe and sane choice for this.
2021-04-06 09:35:10 -07:00
pgjones
26932dad46 Add syntatic sugar for route registration
This takes a popular API whereby instead of passing the HTTP method as
an argument to route it is instead used as the method name i.e.

    @app.route("/", methods=["POST"])

is now writeable as,

    @app.post("/")

This is simply syntatic sugar, it doesn't do anything else, but makes
it slightly easier for users.

I've included all the methods that are relevant and aren't auto
generated i.e. not connect, head, options, and trace.
2021-03-08 08:55:14 -08:00