Commit Graph

109 Commits

Author SHA1 Message Date
David Lord 6650764e97
remove previously deprecated code 2023-02-23 08:35:16 -08:00
David Lord ef95998d79
deprecate FLASK_ENV 2022-08-01 15:11:21 -07:00
David Lord 39f9363296
finish moving url_for to app
move entire implementation to app
make special build args actual keyword-only args
handle no app context in method
mention other config in server_name error
implicit external with scheme
use adapter.build url_scheme argument
rewrite documentation
2022-05-14 12:46:01 -07:00
dzcode eb5dd9f5ef
add aborter object to app 2022-05-12 13:29:54 -07:00
Tim Hoagland fdab801fbb
add redirect method to app 2022-05-10 11:02:24 -07: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
David Lord a0e2aca770
move json tests to separate file 2020-10-31 20:16:24 -07:00
Paul Sanders 8c6baeedab
parametrize some tests (#3786) 2020-10-11 19:16:17 -07:00
Martin Thoma 75a9b74650
DOC: Remove unnecessary docstrings 2020-07-26 15:47:12 +02:00
David Lord 8b5f760b72
deprecate JSON encoding options
make consistent with built-in json module
2020-04-07 12:32:27 -07:00
David Lord c43edfc7c0
remove simplejson
- remove encoding detection backport, json.loads supports it directly
- use str.translate instead of multiple str.replace
2020-04-07 09:55:39 -07:00
David Lord f2f027d1fb
remove unused module docstrings 2020-04-04 12:28:08 -07:00
David Lord 2ae740dd49
f-strings everywhere 2020-04-04 12:10:00 -07:00
David Lord 524fd0bc8c
apply pyupgrade 2020-04-04 12:10:00 -07:00
David Lord 57d628ca74
remove more compat code 2020-04-04 12:10:00 -07:00
David Lord 662c245795
remove _compat module 2020-04-04 12:10:00 -07:00
David Lord 980168d084
send_file doesn't allow StringIO 2019-11-19 08:52:12 -08:00
Fernanda Guimarães c367a86cc5 Test test_send_from_directory_bad_request no longer fails in Python 3.8. 2019-10-28 21:37:25 -03:00
David Lord b05a685a03
Merge branch '1.0.x' 2019-07-01 10:54:31 -07:00
Anthony Sottile a5ecdfa7a5
Fixes for PEP451 import loaders and pytest 5.x
- pytest 5.x drops python2 compatibility and therefore only implements PEP 451
- pytest 5.x made the repr of `ExcInfo` less confusing (fixed tests depending
  on the old format)
2019-07-01 10:43:06 -07:00
David Lord afd6250bab
Merge branch '1.0.x' 2019-07-01 09:52:06 -07:00
David Lord 54cbb4e642
send_file quotes ":/" in UTF-8 filename 2019-06-27 07:55:22 -07:00
David Lord 1351d0a565
Merge branch '1.0.x' 2019-06-23 16:57:52 -07:00
David Lord e666f7a69c
standardize license and copyright 2019-06-22 13:09:09 -07:00
David Lord 29111a3259
Merge branch '1.0.x' 2019-06-12 10:41:11 -07:00
David Lord dbd4520ccb
fix tests failing with server name warnings
After pallets/werkzeug#1577, mismatched configured and real server
names will show a warning in addition to raising 404. This caused
tests that did this deliberately to fail.

This patch removes the pytest fixture we were using to fail on
warnings, instead using the standard `-Werror` option. This speeds
up the tests by ~3x.
2019-06-10 14:05:33 -07:00
David Lord 43483683b2
apply reorder-python-imports pre-commit config 2019-06-01 09:07:20 -07:00
Jon S. Stumpf b46f5942a5
address flake8 issues 2019-06-01 06:31:35 -07:00
Daniel Pope a5ff3cd01b Fix style issues on master using Black 2019-05-31 11:57:28 +01:00
EtiennePelletier 8590d65a57
Use Werkzeug's JSONMixin class and update tests
Flask's JSONMixin class was moved to Werkzeug>=0.15

Co-authored-by: Jeffrey Eliasen <jeff@jke.net>
2019-05-18 20:57:26 -07:00
David Lord 6f703a564c
clean up open_resource and tests 2019-05-17 13:23:27 -07:00
icreatedanaccount ad709be46e
Allow mode='rt' on open_resource() helper 2019-05-17 13:22:13 -07:00
David Baumgold 025589ee76 Reformat with black
https://github.com/python/black
2019-05-06 16:28:58 -04:00
David Lord a74864ec22
Merge remote-tracking branch 'origin/1.0-maintenance' 2019-01-07 10:00:10 -08:00
garenchan 40118e785f
Make sure the attachment filename is text type.
If attachment filename is bytes type and contains non-ascii coded bytes,
then the following ASCII encoding process will trigger
UnicodeDecodeError exception.

Fix issue #2933.
2019-01-07 07:17:33 -08:00
David Lord 366f3f49af
add changelog for GH-2957 2019-01-07 06:56:20 -08:00
Ignasi Bosch b570bf699c
Allow partial content on bytesio 2019-01-07 06:17:36 -08:00
Matt Robenolt 25de45cbb6
Add support for PathLike objects in static file helpers
See: https://www.python.org/dev/peps/pep-0519/

This is mostly encountered with pathlib in python 3, but this API
suggests any PathLike object can be treated like a filepath with
`__fspath__` function.
2019-01-05 15:23:47 -08:00
David Lord b51ab3ff2c
encode filenames as ascii instead of latin-1
latin-1 is allowed by pep3333, but that breaks gunicorn
2018-05-28 06:36:47 -07:00
David Lord ab4142215d
detect UTF encodings when loading json 2018-04-10 09:34:59 -07:00
fphonor 171eb28c95
get_json separate cache depending on silent arg 2018-04-09 02:52:40 -07:00
David Lord 310fbfcf64
revert copyright year to project start
add copyright header to files
2018-02-08 12:43:30 -08:00
Armin Ronacher 2433522d29
Add Support for FLASK_ENV (#2570)
This introduces environments to Flask
2018-01-06 17:07:56 +01:00
Adrian Moennich 777cc17de3 Fix broken test 2017-11-25 00:53:43 +01:00
Adrian Moennich eb1c2faf9f Merge remote-tracking branch 'upstream/0.12-maintenance' 2017-11-25 00:44:07 +01:00
ThiefMaster c52e1b7388 Fix ValueError for some invalid Range requests
fixes #2526
2017-11-25 00:37:49 +01:00
David Lord 66b1b752da
simplify logging configuration
single default handler and formatter
don't remove handlers
configure level once using setLevel
document logging
reorganize logging tests
2017-07-31 12:49:03 -07:00
Eugene M. Kim 63ccdada1b Actually hand-spin and use a tzinfo subclass
This is for Python 2.x compatibility.

Suggested-by: David Lord <davidism@gmail.com>
2017-06-14 14:23:13 -07:00
Eugene M. Kim f803760275 Re-revert to not using pytz
Will spin a tzinfo subclass.
2017-06-14 14:14:18 -07:00
Eugene M. Kim 34050630d6 Skip aware datetime tests if pytz is unavailable 2017-06-14 14:08:42 -07:00