add changelog for GH-2957
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent b570bf6 · Browse files · 3 files·+15 added−13 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+15 added−13 removed
- tests:+0 added−4 removed
- other:+15 added−9 removed
Provenance
- Commit
366f3f4- Tree
8458f33- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
b570bf6
3 files changed+15 added−13 removed
modified:flask/helpers.py+4 added-2 removed
509 unmodified lines510 Filenames are encoded with ASCII instead of Latin-1 for broader511 compatibility with WSGI servers.512 513 .. versionchanged:: 1.1514- Filenames may be a `PathLike` object.514+ Filename may be a :class:`~os.PathLike` object.515+516 .. versionadded:: 1.1516- Partial content supports ``BytesIO``.517+ Partial content supports :class:`~io.BytesIO`.518 519 :param filename_or_fp: the filename of the file to send.520 This is relative to the :attr:`~Flask.root_path`521 if a relative path is specified.84 unmodified lines606 elif isinstance(file, io.BytesIO):607 try:608 fsize = file.getbuffer().nbytes609 except AttributeError:610+ # Python 2 doesn't have getbuffer611 fsize = len(file.getvalue())612 headers['Content-Length'] = fsize613 data = wrap_file(request.environ, file)614 453 unmodified linesmodified:tests/test_helpers.py-4 removed
607 unmodified lines608 datetime.datetime(1999, 1, 1))})609 assert rv.status_code == 200610 rv.close()611 612- @pytest.mark.skipif(613- not callable(getattr(Range, 'to_content_range_header', None)),614- reason="not implemented within werkzeug"615- )612 def test_send_file_range_request_bytesio(self, app, client):613 @app.route('/')614 def index():615 file = io.BytesIO(b'somethingsomething')389 unmodified linesmodified:CHANGES.rst+11 added-7 removed
8 unmodified lines9 10 Unreleased11 12 - :meth:`flask.RequestContext.copy` includes the current session13- object in the request context copy. This prevents ``flask.session``14- pointing to an out-of-date object. (`#2935`)15-- Using built-in RequestContext, unprintable Unicode characters in Host16- header will result in a HTTP 400 response and not HTTP 500 as previously.17- (`#2994`)18-- :func:`send_file` supports ``PathLike`` objects as describe in19- PEP 0519, to support ``pathlib`` in Python 3. (`#3059`_)13+ object in the request context copy. This prevents ``session``14+ pointing to an out-of-date object. (`#2935`_)15+- Using built-in RequestContext, unprintable Unicode characters in16+ Host header will result in a HTTP 400 response and not HTTP 500 as17+ previously. (`#2994`_)18+- :func:`send_file` supports :class:`~os.PathLike` objects as19+ described in PEP 0519, to support :mod:`pathlib` in Python 3.20+ (`#3059`_)21+- :func:`send_file` supports :class:`~io.BytesIO` partial content.22+ (`#2957`_)23 24 .. _#2935: https://github.com/pallets/flask/issues/293525+.. _#2957: https://github.com/pallets/flask/issues/295726 .. _#2994: https://github.com/pallets/flask/pull/299427 .. _#3059: https://github.com/pallets/flask/pull/305928 29 931 unmodified lines