Merge branch '2.0.x'

This commit is contained in:
David Lord 2021-11-01 12:41:10 -07:00
commit 0ae0f5957f
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
10 changed files with 50 additions and 50 deletions

View File

@ -14,11 +14,11 @@ repos:
files: "^(?!examples/)" files: "^(?!examples/)"
args: ["--application-directories", "src"] args: ["--application-directories", "src"]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 21.9b0 rev: 21.10b0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 3.9.2 rev: 4.0.1
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: additional_dependencies:

View File

@ -38,7 +38,7 @@ method::
app.config.update( app.config.update(
TESTING=True, TESTING=True,
SECRET_KEY=b'_5#y2L"F4Q8z\n\xec]/' SECRET_KEY='192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf'
) )
@ -180,8 +180,8 @@ The following configuration values are used internally by Flask:
application. It should be a long random ``bytes`` or ``str``. For application. It should be a long random ``bytes`` or ``str``. For
example, copy the output of this to your config:: example, copy the output of this to your config::
$ python -c 'import os; print(os.urandom(16))' $ python -c 'import secrets; print(secrets.token_hex())'
b'_5#y2L"F4Q8z\n\xec]/' '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf'
**Do not reveal the secret key when posting questions or committing code.** **Do not reveal the secret key when posting questions or committing code.**
@ -468,7 +468,7 @@ sure to use uppercase letters for your config keys.
Here is an example of a configuration file:: Here is an example of a configuration file::
# Example configuration # Example configuration
SECRET_KEY = b'_5#y2L"F4Q8z\n\xec]/' SECRET_KEY = '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf'
Make sure to load the configuration very early on, so that extensions have Make sure to load the configuration very early on, so that extensions have
the ability to access the configuration when starting up. There are other the ability to access the configuration when starting up. There are other

View File

@ -113,16 +113,16 @@ raw cursor and connection objects.
Here is how you can use it:: Here is how you can use it::
for user in query_db('select * from users'): for user in query_db('select * from users'):
print user['username'], 'has the id', user['user_id'] print(user['username'], 'has the id', user['user_id'])
Or if you just want a single result:: Or if you just want a single result::
user = query_db('select * from users where username = ?', user = query_db('select * from users where username = ?',
[the_username], one=True) [the_username], one=True)
if user is None: if user is None:
print 'No such user' print('No such user')
else: else:
print the_username, 'has the id', user['user_id'] print(the_username, 'has the id', user['user_id'])
To pass variable parts to the SQL statement, use a question mark in the To pass variable parts to the SQL statement, use a question mark in the
statement and pass in the arguments as a list. Never directly add them to statement and pass in the arguments as a list. Never directly add them to

View File

@ -847,8 +847,8 @@ sessions work::
generator. Use the following command to quickly generate a value for generator. Use the following command to quickly generate a value for
:attr:`Flask.secret_key` (or :data:`SECRET_KEY`):: :attr:`Flask.secret_key` (or :data:`SECRET_KEY`)::
$ python -c 'import os; print(os.urandom(16))' $ python -c 'import secrets; print(secrets.token_hex())'
b'_5#y2L"F4Q8z\n\xec]/' '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf'
A note on cookie-based sessions: Flask will take the values you put into the A note on cookie-based sessions: Flask will take the values you put into the
session object and serialize them into a cookie. If you are finding some session object and serialize them into a cookie. If you are finding some

View File

@ -177,7 +177,7 @@ With Blinker 1.1 you can also easily subscribe to signals by using the new
@template_rendered.connect_via(app) @template_rendered.connect_via(app)
def when_template_rendered(sender, template, context, **extra): def when_template_rendered(sender, template, context, **extra):
print f'Template {template.name} is rendered with {context}' print(f'Template {template.name} is rendered with {context}')
Core Signals Core Signals
------------ ------------

View File

@ -88,9 +88,9 @@ You can use the following command to output a random secret key:
.. code-block:: none .. code-block:: none
$ python -c 'import os; print(os.urandom(16))' $ python -c 'import secrets; print(secrets.token_hex())'
b'_5#y2L"F4Q8z\n\xec]/' '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf'
Create the ``config.py`` file in the instance folder, which the factory Create the ``config.py`` file in the instance folder, which the factory
will read from if it exists. Copy the generated value into it. will read from if it exists. Copy the generated value into it.
@ -98,7 +98,7 @@ will read from if it exists. Copy the generated value into it.
.. code-block:: python .. code-block:: python
:caption: ``venv/var/flaskr-instance/config.py`` :caption: ``venv/var/flaskr-instance/config.py``
SECRET_KEY = b'_5#y2L"F4Q8z\n\xec]/' SECRET_KEY = '192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf'
You can also set any other necessary configuration here, although You can also set any other necessary configuration here, although
``SECRET_KEY`` is the only one needed for Flaskr. ``SECRET_KEY`` is the only one needed for Flaskr.

View File

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with python 3.9 # This file is autogenerated by pip-compile with python 3.10
# To update, run: # To update, run:
# #
# pip-compile requirements/dev.in # pip-compile requirements/dev.in
@ -16,15 +16,15 @@ backports.entry-points-selectable==1.1.0
# via virtualenv # via virtualenv
blinker==1.4 blinker==1.4
# via -r requirements/tests.in # via -r requirements/tests.in
certifi==2021.5.30 certifi==2021.10.8
# via requests # via requests
cffi==1.14.6 cffi==1.15.0
# via cryptography # via cryptography
cfgv==3.3.1 cfgv==3.3.1
# via pre-commit # via pre-commit
charset-normalizer==2.0.6 charset-normalizer==2.0.7
# via requests # via requests
click==8.0.1 click==8.0.3
# via pip-tools # via pip-tools
cryptography==35.0.0 cryptography==35.0.0
# via -r requirements/typing.in # via -r requirements/typing.in
@ -34,21 +34,21 @@ docutils==0.16
# via # via
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
filelock==3.2.0 filelock==3.3.2
# via # via
# tox # tox
# virtualenv # virtualenv
greenlet==1.1.2 greenlet==1.1.2
# via -r requirements/tests.in # via -r requirements/tests.in
identify==2.2.15 identify==2.3.3
# via pre-commit # via pre-commit
idna==3.2 idna==3.3
# via requests # via requests
imagesize==1.2.0 imagesize==1.2.0
# via sphinx # via sphinx
iniconfig==1.1.1 iniconfig==1.1.1
# via pytest # via pytest
jinja2==3.0.1 jinja2==3.0.2
# via sphinx # via sphinx
markupsafe==2.0.1 markupsafe==2.0.1
# via jinja2 # via jinja2
@ -58,7 +58,7 @@ mypy-extensions==0.4.3
# via mypy # via mypy
nodeenv==1.6.0 nodeenv==1.6.0
# via pre-commit # via pre-commit
packaging==21.0 packaging==21.2
# via # via
# pallets-sphinx-themes # pallets-sphinx-themes
# pytest # pytest
@ -66,9 +66,9 @@ packaging==21.0
# tox # tox
pallets-sphinx-themes==2.0.1 pallets-sphinx-themes==2.0.1
# via -r requirements/docs.in # via -r requirements/docs.in
pep517==0.11.0 pep517==0.12.0
# via pip-tools # via pip-tools
pip-tools==6.3.0 pip-tools==6.4.0
# via -r requirements/dev.in # via -r requirements/dev.in
platformdirs==2.4.0 platformdirs==2.4.0
# via virtualenv # via virtualenv
@ -92,11 +92,11 @@ pyparsing==2.4.7
# via packaging # via packaging
pytest==6.2.5 pytest==6.2.5
# via -r requirements/tests.in # via -r requirements/tests.in
python-dotenv==0.19.0 python-dotenv==0.19.1
# via -r requirements/tests.in # via -r requirements/tests.in
pytz==2021.1 pytz==2021.3
# via babel # via babel
pyyaml==5.4.1 pyyaml==6.0
# via pre-commit # via pre-commit
requests==2.26.0 requests==2.26.0
# via sphinx # via sphinx
@ -137,21 +137,21 @@ toml==0.10.2
# pre-commit # pre-commit
# pytest # pytest
# tox # tox
tomli==1.2.1 tomli==1.2.2
# via pep517 # via pep517
tox==3.24.4 tox==3.24.4
# via -r requirements/dev.in # via -r requirements/dev.in
types-contextvars==0.1.4 types-contextvars==2.4.0
# via -r requirements/typing.in # via -r requirements/typing.in
types-dataclasses==0.1.7 types-dataclasses==0.6.1
# via -r requirements/typing.in # via -r requirements/typing.in
types-setuptools==57.4.0 types-setuptools==57.4.2
# via -r requirements/typing.in # via -r requirements/typing.in
typing-extensions==3.10.0.2 typing-extensions==3.10.0.2
# via mypy # via mypy
urllib3==1.26.7 urllib3==1.26.7
# via requests # via requests
virtualenv==20.8.1 virtualenv==20.10.0
# via # via
# pre-commit # pre-commit
# tox # tox

View File

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with python 3.9 # This file is autogenerated by pip-compile with python 3.10
# To update, run: # To update, run:
# #
# pip-compile requirements/docs.in # pip-compile requirements/docs.in
@ -8,23 +8,23 @@ alabaster==0.7.12
# via sphinx # via sphinx
babel==2.9.1 babel==2.9.1
# via sphinx # via sphinx
certifi==2021.5.30 certifi==2021.10.8
# via requests # via requests
charset-normalizer==2.0.6 charset-normalizer==2.0.7
# via requests # via requests
docutils==0.16 docutils==0.16
# via # via
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
idna==3.2 idna==3.3
# via requests # via requests
imagesize==1.2.0 imagesize==1.2.0
# via sphinx # via sphinx
jinja2==3.0.1 jinja2==3.0.2
# via sphinx # via sphinx
markupsafe==2.0.1 markupsafe==2.0.1
# via jinja2 # via jinja2
packaging==21.0 packaging==21.2
# via # via
# pallets-sphinx-themes # pallets-sphinx-themes
# sphinx # sphinx
@ -36,7 +36,7 @@ pygments==2.10.0
# sphinx-tabs # sphinx-tabs
pyparsing==2.4.7 pyparsing==2.4.7
# via packaging # via packaging
pytz==2021.1 pytz==2021.3
# via babel # via babel
requests==2.26.0 requests==2.26.0
# via sphinx # via sphinx

View File

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with python 3.9 # This file is autogenerated by pip-compile with python 3.10
# To update, run: # To update, run:
# #
# pip-compile requirements/tests.in # pip-compile requirements/tests.in
@ -14,7 +14,7 @@ greenlet==1.1.2
# via -r requirements/tests.in # via -r requirements/tests.in
iniconfig==1.1.1 iniconfig==1.1.1
# via pytest # via pytest
packaging==21.0 packaging==21.2
# via pytest # via pytest
pluggy==1.0.0 pluggy==1.0.0
# via pytest # via pytest
@ -24,7 +24,7 @@ pyparsing==2.4.7
# via packaging # via packaging
pytest==6.2.5 pytest==6.2.5
# via -r requirements/tests.in # via -r requirements/tests.in
python-dotenv==0.19.0 python-dotenv==0.19.1
# via -r requirements/tests.in # via -r requirements/tests.in
toml==0.10.2 toml==0.10.2
# via pytest # via pytest

View File

@ -1,10 +1,10 @@
# #
# This file is autogenerated by pip-compile with python 3.9 # This file is autogenerated by pip-compile with python 3.10
# To update, run: # To update, run:
# #
# pip-compile requirements/typing.in # pip-compile requirements/typing.in
# #
cffi==1.14.6 cffi==1.15.0
# via cryptography # via cryptography
cryptography==35.0.0 cryptography==35.0.0
# via -r requirements/typing.in # via -r requirements/typing.in
@ -16,11 +16,11 @@ pycparser==2.20
# via cffi # via cffi
toml==0.10.2 toml==0.10.2
# via mypy # via mypy
types-contextvars==0.1.4 types-contextvars==2.4.0
# via -r requirements/typing.in # via -r requirements/typing.in
types-dataclasses==0.1.7 types-dataclasses==0.6.1
# via -r requirements/typing.in # via -r requirements/typing.in
types-setuptools==57.4.0 types-setuptools==57.4.2
# via -r requirements/typing.in # via -r requirements/typing.in
typing-extensions==3.10.0.2 typing-extensions==3.10.0.2
# via mypy # via mypy