Skip to content
Myr

Merge remote-tracking branch 'origin/stable'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parents 2eab96a, 6c44dd4 · Browse files · 11 files+79 added−62 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

11 files+79 added−62 removed

  • tests:+1 added−1 removed
  • other:+78 added−61 removed

11 files+79 added−62 removed

modified:docs/tutorial/database.rst+10 added
35 unmodified lines
36.. code-block:: python37 :caption: ``flaskr/db.py``3839 import sqlite340 from datetime import datetime4142 import click43 from flask import current_app, g44
87 unmodified lines
132 """Clear the existing data and create new tables."""133 init_db()134 click.echo('Initialized the database.')135136137 sqlite3.register_converter(138 "timestamp", lambda v: datetime.fromisoformat(v.decode())139 )140141:meth:`open_resource() <Flask.open_resource>` opens a file relative to142the ``flaskr`` package, which is useful since you won't necessarily know143where that location is when deploying the application later. ``get_db``144returns a database connection, which is used to execute the commands
2 unmodified lines
147:func:`click.command` defines a command line command called ``init-db``148that calls the ``init_db`` function and shows a success message to the149user. You can read :doc:`/cli` to learn more about writing commands.150151The call to :func:`sqlite3.register_converter` tells Python how to152interpret timestamp values in the database. We convert the value to a153:class:`datetime.datetime`.154155156Register with the Application157-----------------------------158159The ``close_db`` and ``init_db_command`` functions need to be registered
60 unmodified lines
modified:examples/celery/pyproject.toml+2 added-2 removed
modified:examples/javascript/tests/test_js_example.py+1 added-1 removed
3 unmodified lines
45@pytest.mark.parametrize(6 ("path", "template_name"),7 (8 ("/", "xhr.html"),8 ("/", "fetch.html"),9 ("/plain", "xhr.html"),10 ("/fetch", "fetch.html"),11 ("/jquery", "jquery.html"),12 ),
15 unmodified lines
deleted:examples/javascript/LICENSE.rst-28 removed
1Copyright 2010 Pallets23Redistribution and use in source and binary forms, with or without4modification, are permitted provided that the following conditions are5met:671. Redistributions of source code must retain the above copyright8 notice, this list of conditions and the following disclaimer.9102. Redistributions in binary form must reproduce the above copyright11 notice, this list of conditions and the following disclaimer in the12 documentation and/or other materials provided with the distribution.13143. Neither the name of the copyright holder nor the names of its15 contributors may be used to endorse or promote products derived from16 this software without specific prior written permission.1718THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A21PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED24TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR25PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF26LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING27NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS28SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
added:examples/javascript/LICENSE.txt+28 added
1Copyright 2010 Pallets23Redistribution and use in source and binary forms, with or without4modification, are permitted provided that the following conditions are5met:671. Redistributions of source code must retain the above copyright8 notice, this list of conditions and the following disclaimer.9102. Redistributions in binary form must reproduce the above copyright11 notice, this list of conditions and the following disclaimer in the12 documentation and/or other materials provided with the distribution.13143. Neither the name of the copyright holder nor the names of its15 contributors may be used to endorse or promote products derived from16 this software without specific prior written permission.1718THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A21PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED24TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR25PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF26LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING27NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS28SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
modified:examples/javascript/pyproject.toml+2 added-1 removed
modified:examples/tutorial/flaskr/db.py+4 added
1import sqlite32from datetime import datetime34import click5from flask import current_app6from flask import g
37 unmodified lines
44 init_db()45 click.echo("Initialized the database.")464748sqlite3.register_converter("timestamp", lambda v: datetime.fromisoformat(v.decode()))495051def init_app(app):52 """Register database functions with the Flask app. This is called by53 the application factory.54 """
2 unmodified lines
deleted:examples/tutorial/LICENSE.rst-28 removed
1Copyright 2010 Pallets23Redistribution and use in source and binary forms, with or without4modification, are permitted provided that the following conditions are5met:671. Redistributions of source code must retain the above copyright8 notice, this list of conditions and the following disclaimer.9102. Redistributions in binary form must reproduce the above copyright11 notice, this list of conditions and the following disclaimer in the12 documentation and/or other materials provided with the distribution.13143. Neither the name of the copyright holder nor the names of its15 contributors may be used to endorse or promote products derived from16 this software without specific prior written permission.1718THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A21PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED24TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR25PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF26LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING27NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS28SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
added:examples/tutorial/LICENSE.txt+28 added
1Copyright 2010 Pallets23Redistribution and use in source and binary forms, with or without4modification, are permitted provided that the following conditions are5met:671. Redistributions of source code must retain the above copyright8 notice, this list of conditions and the following disclaimer.9102. Redistributions in binary form must reproduce the above copyright11 notice, this list of conditions and the following disclaimer in the12 documentation and/or other materials provided with the distribution.13143. Neither the name of the copyright holder nor the names of its15 contributors may be used to endorse or promote products derived from16 this software without specific prior written permission.1718THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A21PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED24TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR25PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF26LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING27NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS28SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
modified:examples/tutorial/pyproject.toml+2 added-1 removed
1 unmodified line
2name = "flaskr"3version = "1.0.0"4description = "The basic blog app built in the Flask tutorial."5readme = "README.rst"6license = {text = "BSD-3-Clause"}6license = {file = "LICENSE.txt"}7maintainers = [{name = "Pallets", email = "contact@palletsprojects.com"}]8classifiers = ["Private :: Do Not Upload"]9dependencies = [10 "flask",11]12
28 unmodified lines
modified:src/flask/helpers.py+2 added-1 removed
545 unmodified lines
546 If the final path does not point to an existing regular file,547 raises a 404 :exc:`~werkzeug.exceptions.NotFound` error.548549 :param directory: The directory that ``path`` must be located under,550 relative to the current application's root path.550 relative to the current application's root path. This *must not*551 be a value provided by the client, otherwise it becomes insecure.552 :param path: The path to the file to send, relative to553 ``directory``.554 :param kwargs: Arguments to pass to :func:`send_file`.555
79 unmodified lines