Commit graph

168 commits

Author SHA1 Message Date
Rohan salwan
aa6dd09c2c
correctly handle raising deferred errors in cli lazy loading 2021-08-05 19:14:51 -07:00
default-303
892ae95509
jsonify encodes decimal to str 2021-08-05 18:36:13 -07:00
Yourun-Proger
9a2adfba4d
static_folder can be a pathlib.Path 2021-08-05 18:16:20 -07:00
Karuna Tata
e18ed45c88
document return value for config loading methods 2021-08-05 17:38:24 -07:00
Adrian Moennich
6e1b72096d Fix typo in docs 2021-07-06 22:05:31 +02:00
pgjones
a44c722860 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
Pascal Corpet
6a4e7e948d improve typing for app.errorhandler decorator 2021-06-01 19:25:27 +01:00
Miguel Grinberg
270eb2df2a Support View and MethodView instances with async handlers 2021-06-01 18:08:19 +00:00
laggardkernel
491ea32803 Optimize loop in Flask._find_error_handler() 2021-06-01 15:50:20 +00:00
default-303
8e589daaf2
Fix typing of jinja decorators (#4109) 2021-05-29 20:54:35 +02:00
Marat Sharafutdinov
a960236117 Fix type annotation for before_request and before_app_request decorators 2021-05-25 18:29:52 +00:00
Pascal Corpet
f7adb2c813 improve typing for teardown_request 2021-05-24 19:28:57 +00:00
David Lord
e22021d531
start version 2.0.2.dev0 2021-05-21 08:55:31 -07:00
David Lord
fe2d744b53
release version 2.0.1 2021-05-21 08:50:31 -07:00
David Lord
7ab934f6bc
improve typing for stream_with_context 2021-05-21 08:42:44 -07:00
pgjones
3257b7574e Fix blueprint renaming
This ensures that if a blueprint is renamed at the time of
registration that name is used when constructing endpoints, as
expected.
2021-05-21 15:04:30 +01:00
pgjones
714b0a467a Fix blueprint self registration
By raising a ValueError if attempted. I don't see a use case that
makes this worth supporting.
2021-05-21 15:04:30 +01:00
David Lord
9409be6e34 warn when registering same blueprint with same name 2021-05-21 15:04:30 +01:00
David Lord
63b306743f changelog for blueprint registered name 2021-05-21 15:04:30 +01:00
David Lord
67b0b7e30d cache blueprint path calculation 2021-05-21 15:04:18 +01:00
pgjones
c2920e2bd9 Bugfix allow blueprints to be registered with a different name
This allows the same blueprint to be registered multiple times at the
same level, but with differing url_prefixes and names.
2021-05-21 15:04:18 +01:00
pgjones
141fde1d8e Bugfix blueprint naming
Following discussions for Flask we've decided to name blueprints based
on how they are registered. This allows for two different blueprints
to have the same self-name as long as they are registered in different
nested positions. This helps users choose better blueprint names.
2021-05-21 15:04:18 +01:00
pgjones
99afbb277d Fix blueprint nested url_prefix
This ensures that the url_prefix is correctly applied, no matter if
set during the registration override or when constructing the
blueprint.
2021-05-21 15:04:18 +01:00
Alex Hedges
10a36cb60e Improve decorator factory type signatures
These changes are required to preserve the type signatures of the
created decorators.
2021-05-21 08:09:05 +00:00
Alex Hedges
8796b2a784 Use TypeVar for setupmethod()
TypeVar is needed to preserve function signatures. The type cast for
update_wrapper is needed because wapper_func can not use the full
signature that f does.
2021-05-21 08:09:05 +00:00
Alex Hedges
bf982718cf Make add_url_rule() signature consistent
This caused a mypy error when I was making another typing improvement,
so I am fixing it before committing my other changes.
2021-05-21 08:09:05 +00:00
David Lord
10425fb9b1
re-add deprecated Config.from_json method 2021-05-20 13:50:13 -07:00
David Lord
afc907fd0d
use _typeshed.wsgi instead of wsgiref.types 2021-05-17 16:03:12 -07:00
pgjones
6fbdeb80c7 Fix nested blueprint url_prefix
This fixes the case where the blueprint is registered with a
url_prefix but any child blueprints have no prefixes.
2021-05-17 15:47:25 +01:00
David Lord
a7b02b3a07
converters have access to session 2021-05-14 08:11:09 -07:00
Grey Li
e93704fbfd
fix url_prefix argument when nesting blueprints 2021-05-13 15:02:13 -07:00
David Lord
7c5261407d
blueprint name may not contain a dot 2021-05-13 14:31:50 -07:00
Grey Li
d5aadba4d3
improve type hints for send_file and send_from_directory 2021-05-13 13:33:07 -07:00
David Lord
25884c433f
fix typing that wasn't available in Python 3.6.0 2021-05-13 13:06:32 -07:00
David Lord
6fe7f45725
inform mypy that g has arbitrary attributes 2021-05-13 13:06:32 -07:00
David Lord
2baaa8fd8e
fix annotation for g object 2021-05-13 11:36:05 -07:00
David Lord
89475e5d1e
mark top-level names as exported 2021-05-13 11:36:05 -07:00
Grey Li
fc82dd50e3
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
6fb1101f70
start version 2.0.1.dev0 2021-05-11 14:48:08 -07:00
David Lord
f8e63d3991
release version 2.0.0 2021-05-11 14:41:52 -07:00
David Lord
1403d35e2a
update type annotations 2021-05-11 14:41:52 -07:00
David Lord
e2b7d1056c
release version 2.0.0rc2 2021-05-03 07:02:42 -07:00
pgjones
2889da67cb
Remove the async helper method
It is better to encourage users to utilise the app ensure_sync method
(or the newely added async_to_sync method) so that any extensions that
alter these methods take affect throughout the users code.

With the helper method users code fix parts of their code to the
asgiref async_to_sync ignoring any extension changes.
2021-05-03 06:18:41 -07:00
pgjones
7f87f3dd93
Simplify the async handling code
Firstly `run_sync` was a misleading name as it didn't run anything,
instead I think `async_to_sync` is much clearer as it converts a
coroutine function to a function. (Name stolen from asgiref).

Secondly trying to run the ensure_sync during registration made the
code more complex and brittle, e.g. the _flask_async_wrapper
usage. This was done to pay any setup costs during registration rather
than runtime, however this only saved a iscoroutne check. It allows
the weirdness of the Blueprint and Scaffold ensure_sync methods to be
removed.

Switching to runtime ensure_sync usage provides a method for
extensions to also support async, as now documented.
2021-05-03 06:15:39 -07:00
pgjones
cb13128cf0
Remove context copying from run_async function
This was required with the previous implementation of Werkzeug's
locals which didn't persist across threads. However as the current
implementation uses ContextVars which do persist the context copying
is no longer required.
2021-05-03 06:15:39 -07:00
David Lord
77db3d5ede
Merge pull request #3972 from ThiefMaster/click-7
Allow using Click 7 with a DeprecationWarning
2021-04-27 07:58:25 -07:00
Adrian Moennich
26a6cc0f94 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
Adrian Moennich
10b0d6b33f Move get_root_path back to flask.helpers
Many libraries use it so the move is somewhat disruptive.
2021-04-27 16:42:16 +02:00
pgjones
77237093da 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
pgjones
f405c6f19e Initial typing support
This enables type checking in CI and marks the project as typed.
2021-04-26 17:20:24 +01:00