From d0ceb16be956ea3339dd0b7ab67ba3aceac6a9a3 Mon Sep 17 00:00:00 2001 From: Grey Li Date: Sat, 1 Dec 2018 09:01:12 +0800 Subject: [PATCH 01/10] Use imperative tense for CLI help text --- flask/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flask/cli.py b/flask/cli.py index f55f31c7..8804535b 100644 --- a/flask/cli.py +++ b/flask/cli.py @@ -724,7 +724,7 @@ def _validate_key(ctx, param, value): return value -@click.command('run', short_help='Runs a development server.') +@click.command('run', short_help='Run a development server.') @click.option('--host', '-h', default='127.0.0.1', help='The interface to bind to.') @click.option('--port', '-p', default=5000, @@ -776,10 +776,10 @@ def run_command(info, host, port, reload, debugger, eager_loading, threaded=with_threads, ssl_context=cert) -@click.command('shell', short_help='Runs a shell in the app context.') +@click.command('shell', short_help='Run a shell in the app context.') @with_appcontext def shell_command(): - """Runs an interactive Python shell in the context of a given + """Run an interactive Python shell in the context of a given Flask application. The application will populate the default namespace of this shell according to it's configuration. From 4f638b9c28a07a951e46c348388c725c78fd5498 Mon Sep 17 00:00:00 2001 From: Colin Adams Date: Fri, 7 Dec 2018 11:06:38 -0500 Subject: [PATCH 02/10] Clarify prefixing of URLs for blueprint endpoints Clarify that endpoint names are prefixed by the name of the blueprint, but the URL is not automatically prefixed. --- docs/blueprints.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/blueprints.rst b/docs/blueprints.rst index 1b6de08c..d3ab234c 100644 --- a/docs/blueprints.rst +++ b/docs/blueprints.rst @@ -75,11 +75,12 @@ implement a blueprint that does simple rendering of static templates:: abort(404) When you bind a function with the help of the ``@simple_page.route`` -decorator the blueprint will record the intention of registering the -function `show` on the application when it's later registered. +decorator, the blueprint will record the intention of registering the +function ``show`` on the application when it's later registered. Additionally it will prefix the endpoint of the function with the name of the blueprint which was given to the :class:`Blueprint` -constructor (in this case also ``simple_page``). +constructor (in this case also ``simple_page``). The blueprint's name +does not modify the URL, only the endpoint. Registering Blueprints ---------------------- From deb211cf13edd4d9b2c06d6ecc60425f275b5d95 Mon Sep 17 00:00:00 2001 From: garenchan <1412950785@qq.com> Date: Sun, 23 Dec 2018 23:55:42 +0800 Subject: [PATCH 03/10] Add Python 3.7 to CI. --- .appveyor.yml | 1 + .travis.yml | 7 +++++-- tox.ini | 8 ++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 11bb6d4b..7472f576 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,6 +3,7 @@ environment: TOXENV: py,codecov matrix: + - PYTHON: C:\Python37-x64 - PYTHON: C:\Python36-x64 - PYTHON: C:\Python27-x64 diff --git a/.travis.yml b/.travis.yml index b3ba1e19..5e6f8833 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,16 @@ os: linux +dist: xenial sudo: false language: python matrix: include: + - python: 3.7 + env: TOXENV=py,simplejson,devel,lowest,codecov + - python: 3.7 + env: TOXENV=docs-html - python: 3.6 env: TOXENV=py,simplejson,devel,lowest,codecov - - python: 3.6 - env: TOXENV=docs-html - python: 3.5 env: TOXENV=py,codecov - python: 3.4 diff --git a/tox.ini b/tox.ini index cdeee4c3..a207485d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,9 @@ [tox] envlist = - py{36,35,34,27,py} - py{36,27,py}-simplejson - py{36,27,py}-devel - py{36,27,py}-lowest + py{37,36,35,34,27,py} + py{37,36,27,py}-simplejson + py{37,36,27,py}-devel + py{37,36,27,py}-lowest docs-html coverage-report From 8a14c6d67d09d2a27c1d4685415d8ab0d6448561 Mon Sep 17 00:00:00 2001 From: David Lord Date: Sun, 6 Jan 2019 07:52:03 -0800 Subject: [PATCH 04/10] use specific pypy versions for travis xenial remove 3.6 from appveyor, reduce in tox remove deprecated travis feature "sudo: false" split docs and devel,lowest travis envs remove osx py2 env in attempt to finish faster move travis matrix to python key --- .appveyor.yml | 1 - .travis.yml | 41 ++++++++++++++++++----------------------- tox.ini | 6 +++--- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 7472f576..2551a9d9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,7 +4,6 @@ environment: matrix: - PYTHON: C:\Python37-x64 - - PYTHON: C:\Python36-x64 - PYTHON: C:\Python27-x64 init: diff --git a/.travis.yml b/.travis.yml index 5e6f8833..86d7cfea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,37 +1,30 @@ os: linux dist: xenial -sudo: false language: python +python: + - "3.7" + - "3.6" + - "3.5" + - "3.4" + - "2.7" + - nightly + - pypy3.5-6.0 +env: TOXENV=py,codecov matrix: include: - - python: 3.7 - env: TOXENV=py,simplejson,devel,lowest,codecov - - python: 3.7 - env: TOXENV=docs-html - - python: 3.6 - env: TOXENV=py,simplejson,devel,lowest,codecov - - python: 3.5 - env: TOXENV=py,codecov - - python: 3.4 - env: TOXENV=py,codecov - - python: 2.7 - env: TOXENV=py,simplejson,devel,lowest,codecov - - python: pypy3 - env: TOXENV=py,codecov - - python: nightly - env: TOXENV=py + - env: TOXENV=docs-html + - env: TOXENV=devel,lowest,codecov - os: osx language: generic - env: TOXENV=py3,py2,codecov + env: TOXENV=py3,codecov cache: - pip: false directories: - $HOME/Library/Caches/Homebrew - $HOME/Library/Caches/pip allow_failures: - - python: pypy3 - python: nightly + - python: pypy3.5-6.0 - os: osx fast_finish: true @@ -39,7 +32,6 @@ before_install: - | if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew upgrade python - brew install python@2; export PATH="/usr/local/opt/python/libexec/bin:${PATH}" fi @@ -50,12 +42,15 @@ script: - tox cache: - - pip + directories: + - $HOME/.cache/pip + - $HOME/.cache/pre-commit branches: only: - master - - /^.*-maintenance$/ + - /^\d+(\.\d+)*-maintenance$/ + - /^\d+(\.\d+)*(\.x)?$/ notifications: email: false diff --git a/tox.ini b/tox.ini index a207485d..d37d2486 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,9 @@ [tox] envlist = py{37,36,35,34,27,py} - py{37,36,27,py}-simplejson - py{37,36,27,py}-devel - py{37,36,27,py}-lowest + py{37,27,py}-simplejson + py{37,27,py}-devel + py{37,27,py}-lowest docs-html coverage-report From 90aef1b2cff8ac17eec0e69a3cfe1c55c94f9b12 Mon Sep 17 00:00:00 2001 From: Jesse Seldess Date: Fri, 14 Dec 2018 11:59:16 -0500 Subject: [PATCH 05/10] Fix typos found while completing the Flask tutorial --- docs/tutorial/blog.rst | 2 +- docs/tutorial/database.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/blog.rst b/docs/tutorial/blog.rst index 4511d61b..18eac193 100644 --- a/docs/tutorial/blog.rst +++ b/docs/tutorial/blog.rst @@ -314,7 +314,7 @@ Delete The delete view doesn't have its own template, the delete button is part of ``update.html`` and posts to the ``//delete`` URL. Since there -is no template, it will only handle the ``POST`` method then redirect +is no template, it will only handle the ``POST`` method and then redirect to the ``index`` view. .. code-block:: python diff --git a/docs/tutorial/database.rst b/docs/tutorial/database.rst index 51f20b61..5d8bba08 100644 --- a/docs/tutorial/database.rst +++ b/docs/tutorial/database.rst @@ -149,7 +149,7 @@ Register with the Application ----------------------------- The ``close_db`` and ``init_db_command`` functions need to be registered -with the application instance, otherwise they won't be used by the +with the application instance; otherwise, they won't be used by the application. However, since you're using a factory function, that instance isn't available when writing the functions. Instead, write a function that takes an application and does the registration. From 02df042416c312f6c04a5ded8c9404386585c122 Mon Sep 17 00:00:00 2001 From: Rohan Talip Date: Thu, 27 Dec 2018 00:57:00 -0800 Subject: [PATCH 06/10] Corrected a typo in a docstring: "Help object" --> "Helper object" --- flask/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/cli.py b/flask/cli.py index 8804535b..396dcddf 100644 --- a/flask/cli.py +++ b/flask/cli.py @@ -332,7 +332,7 @@ class DispatchingApp(object): class ScriptInfo(object): - """Help object to deal with Flask applications. This is usually not + """Helper object to deal with Flask applications. This is usually not necessary to interface with as it's used internally in the dispatching to click. In future versions of Flask this object will most likely play a bigger role. Typically it's created automatically by the From 24325ecb69a2c51d5b3da3000df715dfd9aba2de Mon Sep 17 00:00:00 2001 From: Mark Amery Date: Thu, 27 Dec 2018 22:04:27 +0000 Subject: [PATCH 07/10] Clarify and add detail to tojson docs Fix some confusing and obsolete prose. --- docs/api.rst | 8 ++++---- docs/templating.rst | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index cdb05638..33bcd8c1 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -312,10 +312,10 @@ JSON module: as string. The :func:`~htmlsafe_dumps` function of this json module is also available -as filter called ``|tojson`` in Jinja2. Note that inside ``script`` -tags no escaping must take place, so make sure to disable escaping -with ``|safe`` if you intend to use it inside ``script`` tags unless -you are using Flask 0.10 which implies that: +as a filter called ``|tojson`` in Jinja2. Note that in versions of Flask prior +to Flask 0.10, you must disable escaping with ``|safe`` if you intend to use +``|tojson`` output inside ``script`` tags. In Flask 0.10 and above, this +happens automatically (but it's harmless to include ``|safe`` anyway). .. sourcecode:: html+jinja diff --git a/docs/templating.rst b/docs/templating.rst index c0af6639..290c0054 100644 --- a/docs/templating.rst +++ b/docs/templating.rst @@ -110,16 +110,25 @@ by Jinja2 itself: is for example very helpful if you try to generate JavaScript on the fly. - Note that inside ``script`` tags no escaping must take place, so make - sure to disable escaping with ``|safe`` before Flask 0.10 if you intend - to use it inside ``script`` tags: - .. sourcecode:: html+jinja + It is also safe to use the output of `|tojson` in a *single-quoted* HTML + attribute: + + .. sourcecode:: html+jinja + + + + Note that in versions of Flask prior to 0.10, if using the output of + ``|tojson`` inside ``script``, make sure to disable escaping with ``|safe``. + In Flask 0.10 and above, this happens automatically. + Controlling Autoescaping ------------------------ From e4ebbd3f5befca0f6891def3ebf292f756ec5f3b Mon Sep 17 00:00:00 2001 From: xtreak Date: Sat, 29 Dec 2018 16:46:14 +0530 Subject: [PATCH 08/10] Fix DeprecationWarning on collections import --- flask/_compat.py | 2 ++ flask/sessions.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/flask/_compat.py b/flask/_compat.py index a3b5b9c1..dfbaae94 100644 --- a/flask/_compat.py +++ b/flask/_compat.py @@ -28,6 +28,7 @@ if not PY2: from inspect import getfullargspec as getargspec from io import StringIO + import collections.abc as collections_abc def reraise(tp, value, tb=None): if value.__traceback__ is not tb: @@ -47,6 +48,7 @@ else: from inspect import getargspec from cStringIO import StringIO + import collections as collections_abc exec('def reraise(tp, value, tb=None):\n raise tp, value, tb') diff --git a/flask/sessions.py b/flask/sessions.py index ec4253d5..c8b7d4e9 100644 --- a/flask/sessions.py +++ b/flask/sessions.py @@ -11,17 +11,17 @@ import hashlib import warnings -from collections import MutableMapping from datetime import datetime from itsdangerous import BadSignature, URLSafeTimedSerializer from werkzeug.datastructures import CallbackDict +from flask._compat import collections_abc from flask.helpers import is_ip, total_seconds from flask.json.tag import TaggedJSONSerializer -class SessionMixin(MutableMapping): +class SessionMixin(collections_abc.MutableMapping): """Expands a basic dictionary with session attributes.""" @property From b85425ac1bc04bd6fc5c90192f9454395f95bd3a Mon Sep 17 00:00:00 2001 From: xtreak Date: Mon, 31 Dec 2018 08:22:36 +0000 Subject: [PATCH 09/10] remove syntax warning from docstring --- flask/app.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/flask/app.py b/flask/app.py index 1d7050b7..49a025cd 100644 --- a/flask/app.py +++ b/flask/app.py @@ -1678,16 +1678,17 @@ class Flask(_PackageBoundObject): return False def handle_user_exception(self, e): - """This method is called whenever an exception occurs that should be - handled. A special case are - :class:`~werkzeug.exception.HTTPException`\s which are forwarded by - this function to the :meth:`handle_http_exception` method. This - function will either return a response value or reraise the - exception with the same traceback. + """This method is called whenever an exception occurs that + should be handled. A special case is :class:`~werkzeug + .exceptions.HTTPException` which is forwarded to the + :meth:`handle_http_exception` method. This function will either + return a response value or reraise the exception with the same + traceback. .. versionchanged:: 1.0 - Key errors raised from request data like ``form`` show the the bad - key in debug mode rather than a generic bad request message. + Key errors raised from request data like ``form`` show the + bad key in debug mode rather than a generic bad request + message. .. versionadded:: 0.7 """ From 40e064fa27a8f2aaaa1518a929ebfcca80efbbb3 Mon Sep 17 00:00:00 2001 From: David Lord Date: Sun, 6 Jan 2019 10:25:16 -0800 Subject: [PATCH 10/10] use "-m virtualenv" in installation doc --- docs/installation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index 0014f136..e172a1c9 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -91,12 +91,12 @@ On Windows: py -3 -m venv venv -If you needed to install virtualenv because you are on an older version of -Python, use the following command instead: +If you needed to install virtualenv because you are using Python 2, use +the following command instead: .. code-block:: sh - virtualenv venv + python2 -m virtualenv venv On Windows: