Commit graph

173 commits

Author SHA1 Message Date
David Lord
174fe4453a
release version 2.0.2 2021-10-04 07:26:47 -07:00
Matthias Paulsen
166a2a6207
Fix callback order for nested blueprints
Handlers registered via url_value_preprocessor, before_request,
context_processor, and url_defaults are called in downward order: First
on the app and last on the current blueprint.

Handlers registered via after_request and teardown_request are called
in upward order: First on the current blueprint and last on the app.
2021-10-03 20:27:24 -07:00
na2shell
9f0da9b770
cli loader handles kwargs in app factory 2021-08-05 19:32:43 -07:00
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
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
pgjones
63893a427b 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
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
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
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
Alex Hedges
a82cc31af8 Update CHANGES.rst 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
a7b02b3a07
converters have access to session 2021-05-14 08:11:09 -07:00
David Lord
8648750997
Merge branch '1.1.x' into 2.0.x 2021-05-13 18:47:06 -07:00
David Lord
64a5d7a018
release version 1.1.4 2021-05-13 18:22:56 -07:00
brettlangdon
3ace642ef3
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
5bd959fbec
Merge branch '1.1.x' into 2.0.x 2021-05-13 16:34:58 -07:00
David Lord
661bbcdb90
release version 1.1.3 2021-05-13 16:22:57 -07:00
David Lord
6d8b4ce9d0
set maximum versions of pallets dependencies 2021-05-13 16:16:45 -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
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
Grey Li
9be01564f2 Update changelog for #3932 2021-04-28 14:20:44 +08: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
David Lord
1a8549debb
Merge pull request #3973 from pgjones/typing 2021-04-27 07:32:10 -07: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
David Lord
e6e75e5547
changelog for bumped pallets versions 2021-04-24 07:31:16 -07:00
David Lord
85b430a366
deprecate total_seconds 2021-04-15 23:14:53 -07:00
David Lord
32272da9ac
shell calls sys.__interativehook__
This will set up readline tab and history completion by default.
2021-04-14 10:01:32 -07:00
pgjones
f92e820b4b
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
6979265fa6
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
705e52684a
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
David Lord
b473e7c97c
use Jinja's tojson filter 2021-02-01 22:48:09 -08:00
Matthew Preble
01621485fd
Ensure session_interface.open_session is called after URL matching (#3776) 2021-02-01 20:41:17 -08:00
David Lord
14f56363a4
rename send_file add_etags to etag 2021-01-29 10:52:48 -08:00
David Lord
dc11cdb4a4
move send_file and send_from_directory to Werkzeug
The implementations were moved to Werkzeug, Flask's functions become
wrappers around Werkzeug to pass some Flask-specific values.

cache_timeout is renamed to max_age. SEND_FILE_MAX_AGE_DEFAULT,
app.send_file_max_age_default, and app.get_send_file_max_age defaults
to None. This tells the browser to use conditional requests rather than
a 12 hour cache.

attachment_filename is renamed to download_name, and is always sent if
a name is known.

Deprecate helpers.safe_join in favor of werkzeug.utils.safe_join.

Removed most of the send_file tests, they're tested in Werkzeug.

In the file upload example, renamed the uploaded_file view to
download_file to avoid a common source of confusion.
2020-11-05 09:27:52 -08:00