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.
This commit is contained in:
parent
15a49e7297
commit
dc11cdb4a4
8 changed files with 260 additions and 654 deletions
|
|
@ -222,7 +222,7 @@ def test_templates_and_static(test_apps):
|
|||
assert flask.render_template("nested/nested.txt") == "I'm nested"
|
||||
|
||||
|
||||
def test_default_static_cache_timeout(app):
|
||||
def test_default_static_max_age(app):
|
||||
class MyBlueprint(flask.Blueprint):
|
||||
def get_send_file_max_age(self, filename):
|
||||
return 100
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue