add changelog for GH-2957
This commit is contained in:
parent
b570bf699c
commit
366f3f49af
3 changed files with 15 additions and 13 deletions
18
CHANGES.rst
18
CHANGES.rst
|
|
@ -10,15 +10,19 @@ Version 1.1
|
||||||
Unreleased
|
Unreleased
|
||||||
|
|
||||||
- :meth:`flask.RequestContext.copy` includes the current session
|
- :meth:`flask.RequestContext.copy` includes the current session
|
||||||
object in the request context copy. This prevents ``flask.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. (`#2935`_)
|
||||||
- Using built-in RequestContext, unprintable Unicode characters in Host
|
- Using built-in RequestContext, unprintable Unicode characters in
|
||||||
header will result in a HTTP 400 response and not HTTP 500 as previously.
|
Host header will result in a HTTP 400 response and not HTTP 500 as
|
||||||
(`#2994`)
|
previously. (`#2994`_)
|
||||||
- :func:`send_file` supports ``PathLike`` objects as describe in
|
- :func:`send_file` supports :class:`~os.PathLike` objects as
|
||||||
PEP 0519, to support ``pathlib`` in Python 3. (`#3059`_)
|
described in PEP 0519, to support :mod:`pathlib` in Python 3.
|
||||||
|
(`#3059`_)
|
||||||
|
- :func:`send_file` supports :class:`~io.BytesIO` partial content.
|
||||||
|
(`#2957`_)
|
||||||
|
|
||||||
.. _#2935: https://github.com/pallets/flask/issues/2935
|
.. _#2935: https://github.com/pallets/flask/issues/2935
|
||||||
|
.. _#2957: https://github.com/pallets/flask/issues/2957
|
||||||
.. _#2994: https://github.com/pallets/flask/pull/2994
|
.. _#2994: https://github.com/pallets/flask/pull/2994
|
||||||
.. _#3059: https://github.com/pallets/flask/pull/3059
|
.. _#3059: https://github.com/pallets/flask/pull/3059
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -511,9 +511,10 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
|
||||||
compatibility with WSGI servers.
|
compatibility with WSGI servers.
|
||||||
|
|
||||||
.. versionchanged:: 1.1
|
.. versionchanged:: 1.1
|
||||||
Filenames may be a `PathLike` object.
|
Filename may be a :class:`~os.PathLike` object.
|
||||||
|
|
||||||
.. versionadded:: 1.1
|
.. versionadded:: 1.1
|
||||||
Partial content supports ``BytesIO``.
|
Partial content supports :class:`~io.BytesIO`.
|
||||||
|
|
||||||
:param filename_or_fp: the filename of the file to send.
|
:param filename_or_fp: the filename of the file to send.
|
||||||
This is relative to the :attr:`~Flask.root_path`
|
This is relative to the :attr:`~Flask.root_path`
|
||||||
|
|
@ -606,6 +607,7 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
|
||||||
try:
|
try:
|
||||||
fsize = file.getbuffer().nbytes
|
fsize = file.getbuffer().nbytes
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
# Python 2 doesn't have getbuffer
|
||||||
fsize = len(file.getvalue())
|
fsize = len(file.getvalue())
|
||||||
headers['Content-Length'] = fsize
|
headers['Content-Length'] = fsize
|
||||||
data = wrap_file(request.environ, file)
|
data = wrap_file(request.environ, file)
|
||||||
|
|
|
||||||
|
|
@ -609,10 +609,6 @@ class TestSendfile(object):
|
||||||
assert rv.status_code == 200
|
assert rv.status_code == 200
|
||||||
rv.close()
|
rv.close()
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
not callable(getattr(Range, 'to_content_range_header', None)),
|
|
||||||
reason="not implemented within werkzeug"
|
|
||||||
)
|
|
||||||
def test_send_file_range_request_bytesio(self, app, client):
|
def test_send_file_range_request_bytesio(self, app, client):
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue