Merge pull request #2624 from pallets/metadata
Before adoption: this commit came in with the history the project adopted, so no landing records it.
update metadata
authored by David Lord · committed by GitHub · parents f9c6f38, a9a078c · Browse files · 67 files·+485 added−704 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
67 files+485 added−704 removed
- tests:+61 added−24 removed
- other:+424 added−680 removed
Provenance
- Commit
4309c7c- Tree
c275492- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
f9c6f38- Parent 2
a9a078c
67 files changed+485 added−704 removed
modified:docs/conf.py+16 added
15 unmodified lines16 import pkg_resources17 import time18 import datetime19 20+from sphinx.application import Sphinx21+22 BUILD_DATE = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))23 24 # If extensions (or modules to document with autodoc) are in another directory,25 # add these directories to sys.path here. If the directory is relative to the271 unmodified lines297 functools.update_wrapper = update_wrapper298 299 unwrap_decorators()300 del unwrap_decorators301+302+303+def setup(app: Sphinx):304+ def cut_module_meta(app, what, name, obj, options, lines):305+ """Remove metadata from autodoc output."""306+ if what != 'module':307+ return308+309+ lines[:] = [310+ line for line in lines311+ if not line.startswith((':copyright:', ':license:'))312+ ]313+314+ app.connect('autodoc-process-docstring', cut_module_meta)modified:docs/index.rst+14 added-19 removed
2 unmodified lines3 Welcome to Flask4 ================5 6 .. image:: _static/logo-full.png7- :alt: Flask: web development, one drop at a time8- :class: floatingflask7+ :alt: Flask: web development, one drop at a time8+ :class: floatingflask9 10-Welcome to Flask's documentation. This documentation is divided into11-different parts. I recommend that you get started with12-:ref:`installation` and then head over to the :ref:`quickstart`.13-Besides the quickstart, there is also a more detailed :ref:`tutorial` that14-shows how to create a complete (albeit small) application with Flask. If15-you'd rather dive into the internals of Flask, check out16-the :ref:`api` documentation. Common patterns are described in the17-:ref:`patterns` section.10+Welcome to Flask's documentation. Get started with :ref:`installation`11+and then get an overview with the :ref:`quickstart`. There is also a12+more detailed :ref:`tutorial` that shows how to create a small but13+complete application with Flask. Common patterns are described in the14+:ref:`patterns` section. The rest of the docs desribe each component of15+Flask in detail, with a full reference in the :ref:`api` section.16 19-Flask depends on two external libraries: the `Jinja2`_ template20-engine and the `Werkzeug`_ WSGI toolkit. These libraries are not documented21-here. If you want to dive into their documentation, check out the22-following links:17+Flask depends on the `Jinja`_ template engine and the `Werkzeug`_ WSGI18+toolkit. The documentation for these libraries can be found at:19 24-- `Jinja2 Documentation <http://jinja.pocoo.org/docs>`_25-- `Werkzeug Documentation <http://werkzeug.pocoo.org/docs>`_20+- `Jinja documentation <http://jinja.pocoo.org/docs>`_21+- `Werkzeug documentation <http://werkzeug.pocoo.org/docs>`_22 23+.. _Jinja: https://www.palletsprojects.com/p/jinja/24+.. _Werkzeug: https://www.palletsprojects.com/p/werkzeug/25 28-.. _Jinja2: http://jinja.pocoo.org/29-.. _Werkzeug: http://werkzeug.pocoo.org/30-26 .. include:: contents.rst.incmodified:examples/blueprintexample/blueprintexample.py+9 added
1+# -*- coding: utf-8 -*-2+"""3+Blueprint Example4+~~~~~~~~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 from flask import Flask11 from simple_page.simple_page import simple_page12 13 app = Flask(__name__)6 unmodified linesmodified:examples/blueprintexample/test_blueprintexample.py+5 added-3 removed
1 # -*- coding: utf-8 -*-2 """3- Blueprint Example Tests4- ~~~~~~~~~~~~~~3+Blueprint Example Tests4+~~~~~~~~~~~~~~~~~~~~~~~5 6- Tests the Blueprint example app6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8 """9+10 import pytest11 12 import blueprintexample13 22 unmodified linesmodified:examples/flaskr/flaskr/blueprints/flaskr.py+1 added-1 removed
4 unmodified lines5 6 A microblog example application written as Flask tutorial with7 Flask and sqlite3.8 9- :copyright: (c) 2015 by Armin Ronacher.9+ :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11 """12 13 from sqlite3 import dbapi2 as sqlite372 unmodified linesmodified:examples/flaskr/flaskr/factory.py+1 added-1 removed
4 unmodified lines5 6 A microblog example application written as Flask tutorial with7 Flask and sqlite3.8 9- :copyright: (c) 2015 by Armin Ronacher.9+ :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11 """12 13 import os51 unmodified linesmodified:examples/flaskr/tests/test_flaskr.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~5 6 Tests the Flaskr application.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import os71 unmodified linesmodified:examples/flaskr/setup.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~5 6 Tests the Flaskr application.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 from setuptools import setup, find_packages15 unmodified linesmodified:examples/jqueryexample/jqueryexample.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~5 6 A simple application that shows how Flask and jQuery get along.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 from flask import Flask, jsonify, render_template, request13 app = Flask(__name__)14 15 14 unmodified linesmodified:examples/minitwit/minitwit/minitwit.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~5 6 A microblogging application written with Flask and sqlite3.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import time244 unmodified linesmodified:examples/minitwit/tests/test_minitwit.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~5 6 Tests the MiniTwit application.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 import os13 import tempfile14 import pytest15 from minitwit import minitwit135 unmodified linesmodified:examples/patterns/largerapp/tests/test_largerapp.py+10 added-1 removed
1+# -*- coding: utf-8 -*-2+"""3+Larger App Tests4+~~~~~~~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 from yourapplication import app11 import pytest12 13 @pytest.fixture3 unmodified lines17 return client18 19 def test_index(client):20 rv = client.get('/')12- assert b"Hello World!" in rv.data21+ assert b"Hello World!" in rv.datamodified:examples/patterns/largerapp/yourapplication/__init__.py+9 added
1+# -*- coding: utf-8 -*-2+"""3+yourapplication4+~~~~~~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 from flask import Flask11 app = Flask('yourapplication')12 13 import yourapplication.viewsmodified:examples/patterns/largerapp/yourapplication/views.py+10 added-1 removed
1+# -*- coding: utf-8 -*-2+"""3+yourapplication.views4+~~~~~~~~~~~~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 from yourapplication import app11 12 @app.route('/')13 def index():5- return 'Hello World!'14+ return 'Hello World!'modified:flask/json/__init__.py+8 added
1 # -*- coding: utf-8 -*-2+"""3+flask.json4+~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 import io11 import uuid12 from datetime import date, datetime13 from flask.globals import current_app, request268 unmodified linesmodified:flask/json/tag.py+3 added
1+# -*- coding: utf-8 -*-2 """3 Tagged JSON4 ~~~~~~~~~~~5 31 unmodified lines37 return OrderedDict(value)38 39 app.session_interface.serializer.register(TagOrderedDict, 0)40 41+:copyright: © 2010 by the Pallets team.42+:license: BSD, see LICENSE for more details.43 """44 45 from base64 import b64decode, b64encode46 from datetime import datetime254 unmodified linesmodified:flask/__init__.py+1 added-1 removed
4 unmodified lines5 6 A microframework based on Werkzeug. It's extensively documented7 and follows best practice patterns.8 9- :copyright: (c) 2015 by Armin Ronacher.9+ :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11 """12 13 __version__ = '0.13-dev'36 unmodified linesmodified:flask/__main__.py+1 added-2 removed
3 unmodified lines4 ~~~~~~~~~~~~~~5 6 Alias for flask.run for the command line.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12-12 if __name__ == '__main__':13 from .cli import main14 main(as_module=True)modified:flask/_compat.py+2 added-1 removed
5 unmodified lines6 Some py2/py3 compatibility support based on a stripped down7 version of six so we don't have to depend on a specific version8 of it.9 10- :copyright: (c) 2015 by Armin Ronacher.10+ :copyright: © 2010 by the Pallets team.11 :license: BSD, see LICENSE for more details.12 """13+14 import sys15 16 PY2 = sys.version_info[0] == 217 _identity = lambda x: x82 unmodified linesmodified:flask/app.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~5 6 This module implements the central WSGI application object.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 import os13 import sys14 import warnings15 from datetime import timedelta2199 unmodified linesmodified:flask/blueprints.py+2 added-1 removed
4 unmodified lines5 6 Blueprints are the recommended way to implement larger or more7 pluggable applications in Flask 0.7 and later.8 9- :copyright: (c) 2015 by Armin Ronacher.9+ :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11 """12+13 from functools import update_wrapper14 15 from .helpers import _PackageBoundObject, _endpoint_from_view_func16 429 unmodified linesmodified:flask/cli.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~5 6 A simple command line application to run flask apps.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 from __future__ import print_function13 14 import ast15 import inspect870 unmodified linesmodified:flask/config.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~5 6 Implements the configuration related objects.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import os253 unmodified linesmodified:flask/ctx.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~5 6 Implements the objects required to keep the context.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import sys403 unmodified linesmodified:flask/debughelpers.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~~~~~5 6 Various helpers to make the development experience better.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 import os13 from warnings import warn14 15 from ._compat import implements_to_string, text_type153 unmodified linesmodified:flask/globals.py+1 added-1 removed
4 unmodified lines5 6 Defines all the global objects that are proxies to the current7 active context.8 9- :copyright: (c) 2015 by Armin Ronacher.9+ :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11 """12 13 from functools import partial48 unmodified linesmodified:flask/helpers.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~5 6 Implements various helpers.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import os1017 unmodified linesmodified:flask/logging.py+9 added
1+# -*- coding: utf-8 -*-2+"""3+flask.logging4+~~~~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 from __future__ import absolute_import11 12 import logging13 import sys65 unmodified linesmodified:flask/sessions.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~5 6 Implements cookie based sessions based on itsdangerous.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 import hashlib13 import warnings14 from collections import MutableMapping15 from datetime import datetime370 unmodified linesmodified:flask/signals.py+2 added-1 removed
4 unmodified lines5 6 Implements signals based on blinker if available, otherwise7 falls silently back to a noop.8 9- :copyright: (c) 2015 by Armin Ronacher.9+ :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11 """12+13 signals_available = False14 try:15 from blinker import Namespace16 signals_available = True41 unmodified linesmodified:flask/templating.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~~~5 6 Implements the bridge to Jinja2.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 from jinja2 import BaseLoader, Environment as BaseEnvironment, \13 TemplateNotFound14 15 from .globals import _request_ctx_stack, _app_ctx_stack135 unmodified linesmodified:flask/testing.py+1 added-1 removed
4 unmodified lines5 6 Implements test support helpers. This module is lazily imported7 and usually not used in production environments.8 9- :copyright: (c) 2015 by Armin Ronacher.9+ :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11 """12 13 import werkzeug182 unmodified linesmodified:flask/views.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~5 6 This module provides class-based views inspired by the ones in Django.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 from .globals import request13 from ._compat import with_metaclass14 15 143 unmodified linesmodified:flask/wrappers.py+3 added-2 removed
3 unmodified lines4 ~~~~~~~~~~~~~~5 6 Implements the WSGI wrappers (request and response).7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 from werkzeug.exceptions import BadRequest13 from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase14 15 from flask import json106 unmodified lines122 #: a before/after handler (``request.url_rule.methods``) etc.123 #: Though if the request's method was invalid for the URL rule,124 #: the valid list is available in ``routing_exception.valid_methods``125 #: instead (an attribute of the Werkzeug exception :exc:`~werkzeug.exceptions.MethodNotAllowed`)125- #: because the request was never internally bound. 126+ #: because the request was never internally bound.127 #:128 #: .. versionadded:: 0.6129 url_rule = None130 65 unmodified linesdeleted:scripts/flaskext_tester.py-309 removed
1-# -*- coding: utf-8 -*-2-"""3- Flask Extension Tests4- ~~~~~~~~~~~~~~~~~~~~~5-6- Tests the Flask extensions.7-8- :copyright: (c) 2015 by Ali Afshar.9- :license: BSD, see LICENSE for more details.10-"""11-12-import os13-import sys14-import shutil15-import urllib216-import tempfile17-import subprocess18-import argparse19-20-from flask import json21-22-from setuptools.package_index import PackageIndex23-from setuptools.archive_util import unpack_archive24-25-flask_svc_url = 'http://flask.pocoo.org/extensions/'26-27-28-# OS X has awful paths when using mkstemp or gettempdir(). I don't29-# care about security or clashes here, so pick something that is30-# actually memorable.31-if sys.platform == 'darwin':32- _tempdir = '/private/tmp'33-else:34- _tempdir = tempfile.gettempdir()35-tdir = _tempdir + '/flaskext-test'36-flaskdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))37-38-39-# virtualenv hack *cough*40-os.environ['PYTHONDONTWRITEBYTECODE'] = ''41-42-43-RESULT_TEMPATE = u'''\44-<!doctype html>45-<title>Flask-Extension Test Results</title>46-<style type=text/css>47- body { font-family: 'Georgia', serif; font-size: 17px; color: #000; }48- a { color: #004B6B; }49- a:hover { color: #6D4100; }50- h1, h2, h3 { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; }51- h1 { font-size: 30px; margin: 15px 0 5px 0; }52- h2 { font-size: 24px; margin: 15px 0 5px 0; }53- h3 { font-size: 19px; margin: 15px 0 5px 0; }54- textarea, code,55- pre { font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono',56- 'Bitstream Vera Sans Mono', monospace!important; font-size: 15px;57- background: #eee; }58- pre { padding: 7px 15px; line-height: 1.3; }59- p { line-height: 1.4; }60- table { border: 1px solid black; border-collapse: collapse;61- margin: 15px 0; }62- td, th { border: 1px solid black; padding: 4px 10px;63- text-align: left; }64- th { background: #eee; font-weight: normal; }65- tr.success { background: #D3F5CC; }66- tr.failed { background: #F5D2CB; }67-</style>68-<h1>Flask-Extension Test Results</h1>69-<p>70- This page contains the detailed test results for the test run of71- all {{ 'approved' if approved }} Flask extensions.72-<h2>Summary</h2>73-<table class=results>74- <thead>75- <tr>76- <th>Extension77- <th>Version78- <th>Author79- <th>License80- <th>Outcome81- {%- for iptr, _ in results[0].logs|dictsort %}82- <th>{{ iptr }}83- {%- endfor %}84- </tr>85- </thead>86- <tbody>87- {%- for result in results %}88- {% set outcome = 'success' if result.success else 'failed' %}89- <tr class={{ outcome }}>90- <th>{{ result.name }}91- <td>{{ result.version }}92- <td>{{ result.author }}93- <td>{{ result.license }}94- <td>{{ outcome }}95- {%- for iptr, _ in result.logs|dictsort %}96- <td><a href="#{{ result.name }}-{{ iptr }}">see log</a>97- {%- endfor %}98- </tr>99- {%- endfor %}100- </tbody>101-</table>102-<h2>Test Logs</h2>103-<p>Detailed test logs for all tests on all platforms:104-{%- for result in results %}105- {%- for iptr, log in result.logs|dictsort %}106- <h3 id="{{ result.name }}-{{ iptr }}">107- {{ result.name }} - {{ result.version }} [{{ iptr }}]</h3>108- <pre>{{ log }}</pre>109- {%- endfor %}110-{%- endfor %}111-'''112-113-114-def log(msg, *args):115- print('[EXTTEST] ' + (msg % args))116-117-118-class TestResult(object):119-120- def __init__(self, name, folder, statuscode, interpreters):121- intrptr = os.path.join(folder, '.tox/%s/bin/python'122- % interpreters[0])123- self.statuscode = statuscode124- self.folder = folder125- self.success = statuscode == 0126-127- def fetch(field):128- try:129- c = subprocess.Popen([intrptr, 'setup.py',130- '--' + field], cwd=folder,131- stdout=subprocess.PIPE)132- return c.communicate()[0].strip()133- except OSError:134- return '?'135- self.name = name136- self.license = fetch('license')137- self.author = fetch('author')138- self.version = fetch('version')139-140- self.logs = {}141- for interpreter in interpreters:142- logfile = os.path.join(folder, '.tox/%s/log/test.log'143- % interpreter)144- if os.path.isfile(logfile):145- self.logs[interpreter] = open(logfile).read()146- else:147- self.logs[interpreter] = ''148-149-150-def create_tdir():151- try:152- shutil.rmtree(tdir)153- except Exception:154- pass155- os.mkdir(tdir)156-157-158-def package_flask():159- distfolder = tdir + '/.flask-dist'160- c = subprocess.Popen(['python', 'setup.py', 'sdist', '--formats=gztar',161- '--dist', distfolder], cwd=flaskdir)162- c.wait()163- return os.path.join(distfolder, os.listdir(distfolder)[0])164-165-166-def get_test_command(checkout_dir):167- if os.path.isfile(checkout_dir + '/Makefile'):168- return 'make test'169- return 'python setup.py test'170-171-172-def fetch_extensions_list():173- req = urllib2.Request(flask_svc_url, headers={'accept':'application/json'})174- d = urllib2.urlopen(req).read()175- data = json.loads(d)176- for ext in data['extensions']:177- yield ext178-179-180-def checkout_extension(name):181- log('Downloading extension %s to temporary folder', name)182- root = os.path.join(tdir, name)183- os.mkdir(root)184- checkout_path = PackageIndex().download(name, root)185-186- unpack_archive(checkout_path, root)187- path = None188- for fn in os.listdir(root):189- path = os.path.join(root, fn)190- if os.path.isdir(path):191- break192- log('Downloaded to %s', path)193- return path194-195-196-tox_template = """[tox]197-envlist=%(env)s198-199-[testenv]200-deps=201- %(deps)s202- distribute203- py204-commands=bash flaskext-runtest.sh {envlogdir}/test.log205-downloadcache=%(cache)s206-"""207-208-209-def create_tox_ini(checkout_path, interpreters, flask_dep):210- tox_path = os.path.join(checkout_path, 'tox-flask-test.ini')211- if not os.path.exists(tox_path):212- with open(tox_path, 'w') as f:213- f.write(tox_template % {214- 'env': ','.join(interpreters),215- 'cache': tdir,216- 'deps': flask_dep217- })218- return tox_path219-220-221-def iter_extensions(only_approved=True):222- for ext in fetch_extensions_list():223- if ext['approved'] or not only_approved:224- yield ext['name']225-226-227-def test_extension(name, interpreters, flask_dep):228- checkout_path = checkout_extension(name)229- log('Running tests with tox in %s', checkout_path)230-231- # figure out the test command and write a wrapper script. We232- # can't write that directly into the tox ini because tox does233- # not invoke the command from the shell so we have no chance234- # to pipe the output into a logfile. The /dev/null hack is235- # to trick py.test (if used) into not guessing widths from the236- # invoking terminal.237- test_command = get_test_command(checkout_path)238- log('Test command: %s', test_command)239- f = open(checkout_path + '/flaskext-runtest.sh', 'w')240- f.write(test_command + ' &> "$1" < /dev/null\n')241- f.close()242-243- # if there is a tox.ini, remove it, it will cause troubles244- # for us. Remove it if present, we are running tox ourselves245- # afterall.246-247- create_tox_ini(checkout_path, interpreters, flask_dep)248- rv = subprocess.call(['tox', '-c', 'tox-flask-test.ini'], cwd=checkout_path)249- return TestResult(name, checkout_path, rv, interpreters)250-251-252-def run_tests(extensions, interpreters):253- results = {}254- create_tdir()255- log('Packaging Flask')256- flask_dep = package_flask()257- log('Running extension tests')258- log('Temporary Environment: %s', tdir)259- for name in extensions:260- log('Testing %s', name)261- result = test_extension(name, interpreters, flask_dep)262- if result.success:263- log('Extension test succeeded')264- else:265- log('Extension test failed')266- results[name] = result267- return results268-269-270-def render_results(results, approved):271- from jinja2 import Template272- items = results.values()273- items.sort(key=lambda x: x.name.lower())274- rv = Template(RESULT_TEMPATE, autoescape=True).render(results=items,275- approved=approved)276- fd, filename = tempfile.mkstemp(suffix='.html')277- os.fdopen(fd, 'w').write(rv.encode('utf-8') + '\n')278- return filename279-280-281-def main():282- parser = argparse.ArgumentParser(description='Runs Flask extension tests')283- parser.add_argument('--all', dest='all', action='store_true',284- help='run against all extensions, not just approved')285- parser.add_argument('--browse', dest='browse', action='store_true',286- help='show browser with the result summary')287- parser.add_argument('--env', dest='env', default='py25,py26,py27',288- help='the tox environments to run against')289- parser.add_argument('--extension=', dest='extension', default=None,290- help='tests a single extension')291- args = parser.parse_args()292-293- if args.extension is not None:294- only_approved = False295- extensions = [args.extension]296- else:297- only_approved = not args.all298- extensions = iter_extensions(only_approved)299-300- results = run_tests(extensions, [x.strip() for x in args.env.split(',')])301- filename = render_results(results, only_approved)302- if args.browse:303- import webbrowser304- webbrowser.open('file:///' + filename.lstrip('/'))305- print('Results written to {}'.format(filename))306-307-308-if __name__ == '__main__':309- main()modified:scripts/make-release.py+50 added-32 removed
1 #!/usr/bin/env python2-# -*- coding: utf-8 -*-3-"""4- make-release5- ~~~~~~~~~~~~6-7- Helper script that performs a release. Does pretty much everything8- automatically for us.9-10- :copyright: (c) 2015 by Armin Ronacher.11- :license: BSD, see LICENSE for more details.12-"""2 from __future__ import print_function14-import sys3+4 import os5 import re6+import sys17-from datetime import datetime, date18-from subprocess import Popen, PIPE7+from datetime import date, datetime8+from subprocess import PIPE, Popen9 20-_date_clean_re = re.compile(r'(\d+)(st|nd|rd|th)')10+_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')11 12 13 def parse_changelog():14 with open('CHANGES.rst') as f:15 lineiter = iter(f)16 for line in lineiter:17 match = re.search('^Version\s+(.*)', line.strip())18+19 if match is None:20 continue21+22 version = match.group(1).strip()23+31- if lineiter.next().count('-') != len(match.group(0)):24+ if next(lineiter).count('-') != len(match.group(0)):25 continue26+27 while 1:34- change_info = lineiter.next().strip()28+ change_info = next(lineiter).strip()29+30 if change_info:31 break32 38- match = re.search(r'released on (\w+\s+\d+\w+\s+\d+)'39- r'(?:, codename (.*))?(?i)', change_info)33+ match = re.search(34+ r'released on (\w+\s+\d+\w+\s+\d+)(?:, codename (.*))?',35+ change_info,36+ flags=re.IGNORECASE37+ )38+39 if match is None:40 continue41 42 datestr, codename = match.groups()1 unmodified line44 45 46 def bump_version(version):47 try:49- parts = map(int, version.split('.'))48+ parts = [int(i) for i in version.split('.')]49 except ValueError:50 fail('Current version is not numeric')51+52 parts[-1] += 153 return '.'.join(map(str, parts))54 55 56 def parse_date(string):57- string = _date_clean_re.sub(r'\1', string)57+ string = _date_strip_re.sub('', string)58 return datetime.strptime(string, '%B %d %Y')59 60 61 def set_filename_version(filename, version_number, pattern):2 unmodified lines64 def inject_version(match):65 before, old, after = match.groups()66 changed.append(True)67 return before + version_number + after68+69 with open(filename) as f:69- contents = re.sub(r"^(\s*%s\s*=\s*')(.+?)(')(?sm)" % pattern,70- inject_version, f.read())70+ contents = re.sub(71+ r"^(\s*%s\s*=\s*')(.+?)(')" % pattern,72+ inject_version, f.read(),73+ flags=re.DOTALL | re.MULTILINE74+ )75 76 if not changed:77 fail('Could not find %s in %s', pattern, filename)78 5 unmodified lines84 info('Setting __init__.py version to %s', version)85 set_filename_version('flask/__init__.py', version, '__version__')86 87 84-def build_and_upload():85- Popen([sys.executable, 'setup.py', 'release', 'sdist', 'bdist_wheel', 'upload']).wait()88+def build():89+ cmd = [sys.executable, 'setup.py', 'sdist', 'bdist_wheel']90+ Popen(cmd).wait()91 92 93 def fail(message, *args):94 print('Error:', message % args, file=sys.stderr)4 unmodified lines99 print(message % args, file=sys.stderr)100 101 102 def get_git_tags():98- return set(Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines())103+ return set(104+ Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines()105+ )106 107 108 def git_is_clean():109 return Popen(['git', 'diff', '--quiet']).wait() == 012 unmodified lines122 def main():123 os.chdir(os.path.join(os.path.dirname(__file__), '..'))124 125 rv = parse_changelog()126+127 if rv is None:128 fail('Could not parse changelog')129 130 version, release_date, codename = rv123- dev_version = bump_version(version) + '-dev'131+ dev_version = bump_version(version) + '.dev'132 133+ info(125- info('Releasing %s (codename %s, release date %s)',126- version, codename, release_date.strftime('%d/%m/%Y'))134+ 'Releasing %s (codename %s, release date %s)',135+ version, codename, release_date.strftime('%d/%m/%Y')136+ )137 tags = get_git_tags()138 139 if version in tags:140 fail('Version "%s" is already tagged', version)141+142 if release_date.date() != date.today():143+ fail(132- fail('Release date is not today (%s != %s)',133- release_date.date(), date.today())144+ 'Release date is not today (%s != %s)',145+ release_date.date(), date.today()146+ )147 148 if not git_is_clean():149 fail('You have uncommitted changes in git')150 151+ try:152+ import wheel # noqa: F401153+ except ImportError:154+ fail('You need to install the wheel package.')155+156 set_init_version(version)157 make_git_commit('Bump version number to %s', version)158 make_git_tag(version)141- build_and_upload()159+ build()160 set_init_version(dev_version)161 162 163 if __name__ == '__main__':1 unmodified linemodified:tests/conftest.py+2 added-1 removed
1 unmodified line2 """3 tests.conftest4 ~~~~~~~~~~~~~~5 6- :copyright: (c) 2015 by the Flask Team, see AUTHORS for more details.6+ :copyright: © 2010 by the Pallets team.7 :license: BSD, see LICENSE for more details.8 """9+10 import gc11 import os12 import pkgutil13 import sys192 unmodified linesmodified:tests/test_appctx.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~5 6 Tests the application context.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import pytest207 unmodified linesmodified:tests/test_basic.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~~~~~~~~5 6 The basic functionality.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import re1880 unmodified linesmodified:tests/test_blueprints.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~~~5 6 Blueprints (and currently modules)7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import pytest817 unmodified linesmodified:tests/test_cli.py+5 added-6 removed
1 unmodified line2 """3 tests.test_cli4 ~~~~~~~~~~~~~~5 6- :copyright: (c) 2016 by the Flask Team, see AUTHORS for more details.6+ :copyright: © 2010 by the Pallets team.7 :license: BSD, see LICENSE for more details.8 """9-#10-# This file was part of Flask-CLI and was modified under the terms its license,11-# the Revised BSD License.12-# Copyright (C) 2015 CERN.13-#9+10+# This file was part of Flask-CLI and was modified under the terms of11+# its Revised BSD License. Copyright © 2015 CERN.12+13 from __future__ import absolute_import14 15 import os16 import ssl517 unmodified linesmodified:tests/test_config.py+1 added-2 removed
1 unmodified line2 """3 tests.test_config4 ~~~~~~~~~~~~~~~~~5 6- :copyright: (c) 2015 by the Flask Team, see AUTHORS for more details.6+ :copyright: © 2010 by the Pallets team.7 :license: BSD, see LICENSE for more details.8 """9 10-10 from datetime import timedelta11 import os12 import textwrap13 194 unmodified linesmodified:tests/test_helpers.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~~~~~~~~~~5 6 Various helpers.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import datetime912 unmodified linesmodified:tests/test_instance_config.py+2 added-1 removed
1 unmodified line2 """3 tests.test_instance4 ~~~~~~~~~~~~~~~~~~~5 6- :copyright: (c) 2015 by the Flask Team, see AUTHORS for more details.6+ :copyright: © 2010 by the Pallets team.7 :license: BSD, see LICENSE for more details.8 """9+10 import os11 import sys12 13 import pytest122 unmodified linesmodified:tests/test_json_tag.py+9 added
1+# -*- coding: utf-8 -*-2+"""3+tests.test_json_tag4+~~~~~~~~~~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 from datetime import datetime11 from uuid import uuid412 13 import pytest61 unmodified linesmodified:tests/test_logging.py+9 added
1+# -*- coding: utf-8 -*-2+"""3+tests.test_logging4+~~~~~~~~~~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 import logging11 import sys12 13 import pytest94 unmodified linesmodified:tests/test_regression.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~~~~~~~~~~~~~5 6 Tests regressions.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import gc87 unmodified linesmodified:tests/test_reqctx.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~5 6 Tests the request context.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import pytest215 unmodified linesmodified:tests/test_signals.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~~~~~~~~~~5 6 Signalling.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import pytest191 unmodified linesmodified:tests/test_subclassing.py+1 added-1 removed
4 unmodified lines5 6 Test that certain behavior of flask can be customized by7 subclasses.8 9- :copyright: (c) 2015 by Armin Ronacher.9+ :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11 """12 13 import flask20 unmodified linesmodified:tests/test_templating.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~~~~5 6 Template functionality7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import pytest431 unmodified linesmodified:tests/test_testing.py+2 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~~~5 6 Test client and more.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11+12 import pytest13 14 import flask15 import werkzeug322 unmodified linesmodified:tests/test_user_error_handler.py+8 added
1 # -*- coding: utf-8 -*-2+"""3+tests.test_user_error_handler4+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~5+6+:copyright: © 2010 by the Pallets team.7+:license: BSD, see LICENSE for more details.8+"""9+10 from werkzeug.exceptions import (11 Forbidden,12 InternalServerError,13 HTTPException,182 unmodified linesmodified:tests/test_views.py+1 added-1 removed
3 unmodified lines4 ~~~~~~~~~~~5 6 Pluggable views.7 8- :copyright: (c) 2015 by Armin Ronacher.8+ :copyright: © 2010 by the Pallets team.9 :license: BSD, see LICENSE for more details.10 """11 12 import pytest227 unmodified linesmodified:.gitattributes+1 added-1 removed
1-CHANGES merge=union1+CHANGES.rst merge=unionmodified:.travis.yml+19 added-1 removed
1+os: linux2 sudo: false3 language: python4 5 matrix:6 include:7 - python: 3.67- env: TOXENV=py,simplejson,devel,lowest,codecov,docs-html8+ env: TOXENV=py,simplejson,devel,lowest,codecov9+ - python: 3.610+ env: TOXENV=docs-html11 - python: 3.512 env: TOXENV=py,codecov13 - python: 3.414 env: TOXENV=py,codecov2 unmodified lines17 - python: pypy18 env: TOXENV=py,codecov19 - python: nightly20 env: TOXENV=py21+ - os: osx22+ language: generic23+ env: TOXENV=py24 allow_failures:25 - python: nightly26 env: TOXENV=py27+ - os: osx28+ language: generic29+ env: TOXENV=py30+ fast_finish: true31 32+before_install:33+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then34+ brew update;35+ brew install python3 redis memcached;36+ virtualenv -p python3 ~/py-env;37+ . ~/py-env/bin/activate;38+ fi39+40 install:41 - pip install tox42 43 script:12 unmodified linesmodified:AUTHORS+9 added-37 removed
1-Flask is written and maintained by Armin Ronacher and2-various contributors:1+Flask is developed and maintained by the Pallets team and community2+contributors. It was created by Armin Ronacher. The core maintainers3+are:4 4-Development Lead5-````````````````5+- David Lord (davidism)6+- Adrian Mönnich (ThiefMaster)7+- Armin Ronacher (mitsuhiko)8+- Marcus Unterwaditzer (untitaker)9 7-- Armin Ronacher <armin.ronacher@active-4.com>10+A full list of contributors is available from git with::11 9-Patches and Suggestions10-```````````````````````11-12-- Adam Byrtek13-- Adam Zapletal14-- Ali Afshar15-- Chris Edgemon16-- Chris Grindstaff17-- Christopher Grebs18-- Daniel Neuhäuser19-- Dan Sully20-- David Lord @davidism21-- Edmond Burnett22-- Florent Xicluna23-- Georg Brandl24-- Hsiaoming Yang @lepture25-- Jeff Widman @jeffwidman26-- Joshua Bronson @jab27-- Justin Quick28-- Kenneth Reitz29-- Keyan Pishdadian30-- Marian Sigler31-- Martijn Pieters32-- Matt Campell33-- Matthew Frazier34-- Michael van Tellingen35-- Ron DuPlain36-- Sebastien Estienne37-- Simon Sapin38-- Stephane Wirtel39-- Thomas Schranz40-- Zhao Xiaohong12+ git shortlog -snemodified:CHANGES.rst+113 added-98 removed
1+.. currentmodule:: flask2+3 Flask Changelog4 ===============5 6 5 unmodified lines12 - **Python 2.6 and 3.3 are no longer supported.** (`pallets/meta#24`_)13 - Bump minimum dependency versions to the latest stable versions:14 Werkzeug >= 0.14, Jinja >= 2.10, itsdangerous >= 0.24, Click >= 5.1.15 (`#2586`_)14-- Make ``app.run()`` into a noop if a Flask application is run from the15- development server on the command line. This avoids some behavior that16- was confusing to debug for newcomers.17-- Change default configuration ``JSONIFY_PRETTYPRINT_REGULAR=False``.18- ``jsonify()`` method returns compressed response by default, and pretty19- response in debug mode. (`#2193`_)20-- Change ``Flask.__init__`` to accept two new keyword arguments,21- ``host_matching`` and ``static_host``. This enables ``host_matching`` to be22- set properly by the time the constructor adds the static route, and enables23- the static route to be properly associated with the required host.24- (``#1559``)25-- ``send_file`` supports Unicode in ``attachment_filename``. (`#2223`_)26-- Pass ``_scheme`` argument from ``url_for`` to ``handle_build_error``.27- (`#2017`_)28-- Add support for ``provide_automatic_options`` in ``add_url_rule`` to disable29- adding OPTIONS method when the ``view_func`` argument is not a class.30- (`#1489`_).31-- ``MethodView`` can inherit method handlers from base classes. (`#1936`_)32-- Errors caused while opening the session at the beginning of the request are33- handled by the app's error handlers. (`#2254`_)34-- Blueprints gained ``json_encoder`` and ``json_decoder`` attributes to35- override the app's encoder and decoder. (`#1898`_)36-- ``Flask.make_response`` raises ``TypeError`` instead of ``ValueError`` for37- bad response types. The error messages have been improved to describe why the38- type is invalid. (`#2256`_)39-- Add ``routes`` CLI command to output routes registered on the application.40- (`#2259`_)16+- Skip :meth:`app.run <Flask.run>` when a Flask application is run from17+ the command line. This avoids some behavior that was confusing to18+ debug.19+- Change the default for :data:`JSONIFY_PRETTYPRINT_REGULAR` to20+ ``False``. :func:`~json.jsonify` returns a compact format by default,21+ and an indented format in debug mode. (`#2193`_)22+- :meth:`Flask.__init__ <Flask>` accepts the ``host_matching`` argument23+ and sets it on :attr:`~Flask.url_map`. (`#1559`_)24+- :meth:`Flask.__init__ <Flask>` accepts the ``static_host`` argument25+ and passes it as the ``host`` argument when defining the static route.26+ (`#1559`_)27+- :func:`send_file` supports Unicode in ``attachment_filename``.28+ (`#2223`_)29+- Pass ``_scheme`` argument from :func:`url_for` to30+ :meth:`~Flask.handle_url_build_error`. (`#2017`_)31+- :meth:`~Flask.add_url_rule` accepts the ``provide_automatic_options``32+ argument to disable adding the ``OPTIONS`` method. (`#1489`_)33+- :class:`~views.MethodView` subclasses inherit method handlers from34+ base classes. (`#1936`_)35+- Errors caused while opening the session at the beginning of the36+ request are handled by the app's error handlers. (`#2254`_)37+- Blueprints gained :attr:`~Blueprint.json_encoder` and38+ :attr:`~Blueprint.json_decoder` attributes to override the app's39+ encoder and decoder. (`#1898`_)40+- :meth:`Flask.make_response` raises ``TypeError`` instead of41+ ``ValueError`` for bad response types. The error messages have been42+ improved to describe why the type is invalid. (`#2256`_)43+- Add ``routes`` CLI command to output routes registered on the44+ application. (`#2259`_)45 - Show warning when session cookie domain is a bare hostname or an IP42- address, as these may not behave properly in some browsers, such as Chrome.43- (`#2282`_)46+ address, as these may not behave properly in some browsers, such as47+ Chrome. (`#2282`_)48 - Allow IP address as exact session cookie domain. (`#2282`_)45-- ``SESSION_COOKIE_DOMAIN`` is set if it is detected through ``SERVER_NAME``.46- (`#2282`_)47-- Auto-detect zero-argument app factory called ``create_app`` or ``make_app``48- from ``FLASK_APP``. (`#2297`_)49-- Factory functions are not required to take a ``script_info`` parameter to50- work with the ``flask`` command. If they take a single parameter or a51- parameter named ``script_info``, the ``ScriptInfo`` object will be passed.52- (`#2319`_)53-- FLASK_APP=myproject.app:create_app('dev') support.54-- ``FLASK_APP`` can be set to an app factory, with arguments if needed, for55- example ``FLASK_APP=myproject.app:create_app('dev')``. (`#2326`_)56-- ``FLASK_APP`` can point to local packages that are not installed in dev mode,57- although `pip install -e` should still be preferred. (`#2414`_)58-- ``View.provide_automatic_options = True`` is set on the view function from59- ``View.as_view``, to be detected in ``app.add_url_rule``. (`#2316`_)49+- ``SESSION_COOKIE_DOMAIN`` is set if it is detected through50+ ``SERVER_NAME``. (`#2282`_)51+- Auto-detect zero-argument app factory called ``create_app`` or52+ ``make_app`` from ``FLASK_APP``. (`#2297`_)53+- Factory functions are not required to take a ``script_info`` parameter54+ to work with the ``flask`` command. If they take a single parameter or55+ a parameter named ``script_info``, the :class:`~cli.ScriptInfo` object56+ will be passed. (`#2319`_)57+- ``FLASK_APP`` can be set to an app factory, with arguments if needed,58+ for example ``FLASK_APP=myproject.app:create_app('dev')``. (`#2326`_)59+- ``FLASK_APP`` can point to local packages that are not installed in60+ editable mode, although ``pip install -e`` is still preferred.61+ (`#2414`_)62+- The :class:`~views.View` class attribute63+ :attr:`~views.View.provide_automatic_options` is set in64+ :meth:`~views.View.as_view`, to be detected by65+ :meth:`~Flask.add_url_rule`. (`#2316`_)66 - Error handling will try handlers registered for ``blueprint, code``,61- ``app, code``, ``blueprint, exception``, ``app, exception``. (`#2314`_)62-- ``Cookie`` is added to the response's ``Vary`` header if the session is63- accessed at all during the request (and it wasn't deleted). (`#2288`_)64-- ``app.test_request_context()`` take ``subdomain`` and ``url_scheme``65- parameters for use when building base URL. (`#1621`_)66-- Set ``APPLICATION_ROOT = '/'`` by default. This was already the implicit67- default when it was set to ``None``.68-- ``TRAP_BAD_REQUEST_ERRORS`` is enabled by default in debug mode.69- ``BadRequestKeyError`` has a message with the bad key in debug mode instead70- of the generic bad request message. (`#2348`_)71-- Allow registering new tags with ``TaggedJSONSerializer`` to support72- storing other types in the session cookie. (`#2352`_)73-- Only open the session if the request has not been pushed onto the context74- stack yet. This allows ``stream_with_context`` generators to access the same75- session that the containing view uses. (`#2354`_)76-- Add ``json`` keyword argument for the test client request methods. This will77- dump the given object as JSON and set the appropriate content type.78- (`#2358`_)79-- Extract JSON handling to a mixin applied to both the request and response80- classes used by Flask. This adds the ``is_json`` and ``get_json`` methods to81- the response to make testing JSON response much easier. (`#2358`_)82-- Removed error handler caching because it caused unexpected results for some83- exception inheritance hierarchies. Register handlers explicitly for each84- exception if you don't want to traverse the MRO. (`#2362`_)67+ ``app, code``, ``blueprint, exception``, ``app, exception``.68+ (`#2314`_)69+- ``Cookie`` is added to the response's ``Vary`` header if the session70+ is accessed at all during the request (and not deleted). (`#2288`_)71+- :meth:`~Flask.test_request_context` accepts ``subdomain`` and72+ ``url_scheme`` arguments for use when building the base URL.73+ (`#1621`_)74+- Set :data:`APPLICATION_ROOT` to ``'/'`` by default. This was already75+ the implicit default when it was set to ``None``.76+- :data:`TRAP_BAD_REQUEST_ERRORS` is enabled by default in debug mode.77+ ``BadRequestKeyError`` has a message with the bad key in debug mode78+ instead of the generic bad request message. (`#2348`_)79+- Allow registering new tags with80+ :class:`~json.tag.TaggedJSONSerializer` to support storing other types81+ in the session cookie. (`#2352`_)82+- Only open the session if the request has not been pushed onto the83+ context stack yet. This allows :func:`~stream_with_context`84+ generators to access the same session that the containing view uses.85+ (`#2354`_)86+- Add ``json`` keyword argument for the test client request methods.87+ This will dump the given object as JSON and set the appropriate88+ content type. (`#2358`_)89+- Extract JSON handling to a mixin applied to both the :class:`Request`90+ and :class:`Response` classes. This adds the :meth:`~Response.is_json`91+ and :meth:`~Response.get_json` methods to the response to make testing92+ JSON response much easier. (`#2358`_)93+- Removed error handler caching because it caused unexpected results for94+ some exception inheritance hierarchies. Register handlers explicitly95+ for each exception if you want to avoid traversing the MRO. (`#2362`_)96 - Fix incorrect JSON encoding of aware, non-UTC datetimes. (`#2374`_)86-- Template auto reloading will honor the ``run`` command's ``debug`` flag even87- if ``app.jinja_env`` was already accessed. (`#2373`_)97+- Template auto reloading will honor debug mode even even if98+ :attr:`~Flask.jinja_env` was already accessed. (`#2373`_)99 - The following old deprecated code was removed. (`#2385`_)100 101 - ``flask.ext`` - import extensions directly by their name instead of102 through the ``flask.ext`` namespace. For example,103 ``import flask.ext.sqlalchemy`` becomes ``import flask_sqlalchemy``.93- - ``Flask.init_jinja_globals`` - extend ``Flask.create_jinja_environment``94- instead.95- - ``Flask.error_handlers`` - tracked by ``Flask.error_handler_spec``,96- use ``@app.errorhandler`` to register handlers.97- - ``Flask.request_globals_class`` - use ``Flask.app_ctx_globals_class``98- instead.99- - ``Flask.static_path`` - use ``Flask.static_url_path`` instead.100- - ``Request.module`` - use ``Request.blueprint`` instead.104+ - ``Flask.init_jinja_globals`` - extend105+ :meth:`Flask.create_jinja_environment` instead.106+ - ``Flask.error_handlers`` - tracked by107+ :attr:`Flask.error_handler_spec`, use :meth:`Flask.errorhandler` to108+ register handlers.109+ - ``Flask.request_globals_class`` - use110+ :attr:`Flask.app_ctx_globals_class` instead.111+ - ``Flask.static_path`` - use :attr:`Flask.static_url_path` instead.112+ - ``Request.module`` - use :attr:`Request.blueprint` instead.113 102-- The ``request.json`` property is no longer deprecated. (`#1421`_)103-- Support passing an existing ``EnvironBuilder`` or ``dict`` to104- ``test_client.open``. (`#2412`_)105-- The ``flask`` command and ``app.run`` will load environment variables using106- from ``.env`` and ``.flaskenv`` files if python-dotenv is installed.107- (`#2416`_)108-- When passing a full URL to the test client, use the scheme in the URL instead109- of the ``PREFERRED_URL_SCHEME``. (`#2430`_)110-- ``app.logger`` has been simplified. ``LOGGER_NAME`` and111- ``LOGGER_HANDLER_POLICY`` config was removed. The logger is always named112- ``flask.app``. The level is only set on first access, it doesn't check113- ``app.debug`` each time. Only one format is used, not different ones114- depending on ``app.debug``. No handlers are removed, and a handler is only115- added if no handlers are already configured. (`#2436`_)116-- Blueprint view function name may not contain dots. (`#2450`_)117-- Fix a ``ValueError`` caused by invalid Range requests in some cases.118- (`#2526`_)119-- The dev server now uses threads by default. (`#2529`_)120-- Loading config files with ``silent=True`` will ignore ``ENOTDIR``121- errors. (`#2581`_)114+- The :attr:`Request.json` property is no longer deprecated. (`#1421`_)115+- Support passing a :class:`~werkzeug.test.EnvironBuilder` or116+ ``dict`` to :meth:`test_client.open <werkzeug.test.Client.open>`.117+ (`#2412`_)118+- The ``flask`` command and :meth:`Flask.run` will load environment119+ variables from ``.env`` and ``.flaskenv`` files if python-dotenv is120+ installed. (`#2416`_)121+- When passing a full URL to the test client, the scheme in the URL is122+ used instead of :data:`PREFERRED_URL_SCHEME`. (`#2430`_)123+- :attr:`Flask.logger` has been simplified. ``LOGGER_NAME`` and124+ ``LOGGER_HANDLER_POLICY`` config was removed. The logger is always125+ named ``flask.app``. The level is only set on first access, it doesn't126+ check :attr:`Flask.debug` each time. Only one format is used, not127+ different ones depending on :attr:`Flask.debug`. No handlers are128+ removed, and a handler is only added if no handlers are already129+ configured. (`#2436`_)130+- Blueprint view function names may not contain dots. (`#2450`_)131+- Fix a ``ValueError`` caused by invalid ``Range`` requests in some132+ cases. (`#2526`_)133+- The development server uses threads by default. (`#2529`_)134+- Loading config files with ``silent=True`` will ignore135+ :data:`~errno.ENOTDIR` errors. (`#2581`_)136 - Pass ``--cert`` and ``--key`` options to ``flask run`` to run the137 development server over HTTPS. (`#2606`_)138 - Added :data:`SESSION_COOKIE_SAMESITE` to control the ``SameSite``139 attribute on the session cookie. (`#2607`_)140 141 .. _pallets/meta#24: https://github.com/pallets/meta/issues/24142 .. _#1421: https://github.com/pallets/flask/issues/1421143 .. _#1489: https://github.com/pallets/flask/pull/1489144+.. _#1559: https://github.com/pallets/flask/issues/1559145 .. _#1621: https://github.com/pallets/flask/pull/1621146 .. _#1898: https://github.com/pallets/flask/pull/1898147 .. _#1936: https://github.com/pallets/flask/pull/1936148 .. _#2017: https://github.com/pallets/flask/pull/2017654 unmodified linesmodified:CONTRIBUTING.rst+16 added-2 removed
129 unmodified lines130 131 Running the full test suite with ``tox`` will combine the coverage reports132 from all runs.133 134-``make`` targets135-~~~~~~~~~~~~~~~~134 135+Building the docs136+~~~~~~~~~~~~~~~~~137+138+Build the docs in the ``docs`` directory using Sphinx::139+140+ cd docs141+ make html142+143+Open ``_build/html/index.html`` in your browser to view the docs.144+145+Read more about `Sphinx <http://www.sphinx-doc.org>`_.146+147+148+make targets149+~~~~~~~~~~~~150+151 Flask provides a ``Makefile`` with various shortcuts. They will ensure that152 all dependencies are installed.153 154 - ``make test`` runs the basic test suite with ``pytest``26 unmodified linesmodified:LICENSE+23 added-25 removed
1-Copyright (c) 2015 by Armin Ronacher and contributors. See AUTHORS2-for more details.1+Copyright © 2010 by the Pallets team.2 3 Some rights reserved.4 6-Redistribution and use in source and binary forms of the software as well7-as documentation, with or without modification, are permitted provided8-that the following conditions are met:5+Redistribution and use in source and binary forms of the software as6+well as documentation, with or without modification, are permitted7+provided that the following conditions are met:8 10-* Redistributions of source code must retain the above copyright11- notice, this list of conditions and the following disclaimer.9+* Redistributions of source code must retain the above copyright notice,10+ this list of conditions and the following disclaimer.11 13-* Redistributions in binary form must reproduce the above14- copyright notice, this list of conditions and the following15- disclaimer in the documentation and/or other materials provided16- with the distribution.12+* Redistributions in binary form must reproduce the above copyright13+ notice, this list of conditions and the following disclaimer in the14+ documentation and/or other materials provided with the distribution.15 18-* The names of the contributors may not be used to endorse or19- promote products derived from this software without specific20- prior written permission.16+* Neither the name of the copyright holder nor the names of its17+ contributors may be used to endorse or promote products derived from18+ this software without specific prior written permission.19 20 THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND23-CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT24-NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR25-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER26-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,27-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,28-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR29-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF30-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING31-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS32-SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH33-DAMAGE.21+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,22+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND23+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE24+COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,25+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT26+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF27+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON28+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT29+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF30+THIS SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF31+SUCH DAMAGE.modified:Makefile-18 removed
7 unmodified lines8 test: clean-pyc install-dev9 pytest10 11 coverage: clean-pyc install-dev12- pip install -q -e .[test]12 coverage run -m pytest13 coverage report14 coverage html15 16 unmodified lines32 clean-pyc:33 find . -name '*.pyc' -exec rm -f {} +34 find . -name '*.pyo' -exec rm -f {} +35 find . -name '*~' -exec rm -f {} +37-38-upload-docs:39- $(MAKE) -C docs html dirhtml latex epub40- $(MAKE) -C docs/_build/latex all-pdf41- cd docs/_build/; mv html flask-docs; zip -r flask-docs.zip flask-docs; mv flask-docs html42- rsync -a docs/_build/dirhtml/ flow.srv.pocoo.org:/srv/websites/flask.pocoo.org/docs/43- rsync -a docs/_build/latex/Flask.pdf flow.srv.pocoo.org:/srv/websites/flask.pocoo.org/docs/flask-docs.pdf44- rsync -a docs/_build/flask-docs.zip flow.srv.pocoo.org:/srv/websites/flask.pocoo.org/docs/flask-docs.zip45- rsync -a docs/_build/epub/Flask.epub flow.srv.pocoo.org:/srv/websites/flask.pocoo.org/docs/flask-docs.epub46-47-# ebook-convert docs: http://manual.calibre-ebook.com/cli/ebook-convert.html48-ebook:49- @echo 'Using .epub from `make upload-docs` to create .mobi.'50- @echo 'Command `ebook-covert` is provided by calibre package.'51- @echo 'Requires X-forwarding for Qt features used in conversion (ssh -X).'52- @echo 'Do not mind "Invalid value for ..." CSS errors if .mobi renders.'53- ssh -X pocoo.org ebook-convert /var/www/flask.pocoo.org/docs/flask-docs.epub /var/www/flask.pocoo.org/docs/flask-docs.mobi --cover http://flask.pocoo.org/docs/_images/logo-full.png --authors 'Armin Ronacher'modified:MANIFEST.in+1 added-1 removed
1-include Makefile CHANGES LICENSE AUTHORS tox.ini1+include Makefile CHANGES.rst LICENSE AUTHORS tox.ini2 3 graft artwork4 graft tests5 graft examples6 unmodified linesdeleted:README-49 removed
1-2-3- // Flask //4-5- web development, one drop at a time6-7-8- ~ What is Flask?9-10- Flask is a microframework for Python based on Werkzeug11- and Jinja2. It's intended for getting started very quickly12- and was developed with best intentions in mind.13-14- ~ Is it ready?15-16- It's still not 1.0 but it's shaping up nicely and is17- already widely used. Consider the API to slightly18- improve over time but we don't plan on breaking it.19-20- ~ What do I need?21-22- All dependencies are installed by using `pip install Flask`.23- We encourage you to use a virtualenv. Check the docs for24- complete installation and usage instructions.25-26- ~ Where are the docs?27-28- Go to http://flask.pocoo.org/docs/ for a prebuilt version29- of the current documentation. Otherwise build them yourself30- from the sphinx sources in the docs folder.31-32- ~ Where are the tests?33-34- Good that you're asking. The tests are in the35- tests/ folder. To run the tests use the36- `pytest` testing tool:37-38- $ pytest39-40- Details on contributing can be found in CONTRIBUTING.rst41-42- ~ Where can I get help?43-44- Either use the #pocoo IRC channel on irc.freenode.net or45- ask on the mailinglist: http://flask.pocoo.org/mailinglist/46-47- See http://flask.pocoo.org/community/ for more resources.48-49-added:README.rst+62 added
1+Flask2+=====3+4+Flask is a lightweight `WSGI`_ web application framework. It is designed5+to make getting started quick and easy, with the ability to scale up to6+complex applications. It began as a simple wrapper around `Werkzeug`_7+and `Jinja`_ and has become one of the most popular Python web8+application frameworks.9+10+Flask offers suggestions, but doesn't enforce any dependencies or11+project layout. It is up to the developer to choose the tools and12+libraries they want to use. There are many extensions provided by the13+community that make adding new functionality easy.14+15+16+Installing17+----------18+19+Install and update using `pip`_:20+21+.. code-block:: text22+23+ pip install -U Flask24+25+26+A Simple Example27+----------------28+29+.. code-block:: python30+31+ from flask import Flask32+33+ app = Flask(__name__)34+35+ @app.route('/')36+ def hello():37+ return 'Hello, World!'38+39+.. code-block:: none40+41+ $ FLASK_APP=hello.py flask run42+ * Running on http://localhost:5000/43+44+45+Links46+-----47+48+* Website: https://www.palletsprojects.com/p/flask/49+* Releases: https://pypi.org/project/Flask/50+* Code: https://github.com/pallets/flask51+* Issue tracker: https://github.com/pallets/flask/issues52+* Test status:53+54+ * Linux, Mac: https://travis-ci.org/pallets/flask55+ * Windows: https://ci.appveyor.com/project/pallets/flask56+57+* Test coverage: https://codecov.io/gh/pallets/flask58+59+.. _WSGI: https://wsgi.readthedocs.io60+.. _Werkzeug: https://www.palletsprojects.com/p/werkzeug/61+.. _Jinja: https://www.palletsprojects.com/p/jinja/62+.. _pip: https://pip.pypa.io/en/stable/quickstart/modified:setup.cfg+1 added-1 removed
1 [aliases]2-release = egg_info -RDb ''2+release = egg_info -Db ''3 4 [bdist_wheel]5 universal = 16 6 unmodified linesmodified:setup.py+12 added-56 removed
1-"""2-Flask3------4-5-Flask is a microframework for Python based on Werkzeug, Jinja 2 and good6-intentions. And before you ask: It's BSD licensed!7-8-Flask is Fun9-````````````10-11-Save in a hello.py:12-13-.. code:: python14-15- from flask import Flask16- app = Flask(__name__)17-18- @app.route("/")19- def hello():20- return "Hello World!"21-22- if __name__ == "__main__":23- app.run()24-25-And Easy to Setup26-`````````````````27-28-And run it:29-30-.. code:: bash31-32- $ pip install Flask33- $ python hello.py34- * Running on http://localhost:5000/35-36-Ready for production? `Read this first <http://flask.pocoo.org/docs/deploying/>`.37-38-Links39-`````40-41-* `website <http://flask.pocoo.org/>`_42-* `documentation <http://flask.pocoo.org/docs/>`_43-* `development version44- <https://github.com/pallets/flask/zipball/master#egg=Flask-dev>`_45-46-"""1+#!/usr/bin/env python2+# -*- coding: utf-8 -*-3+import io4 import re48-import ast5 from setuptools import setup6 51-_version_re = re.compile(r'__version__\s+=\s+(.*)')7+with io.open('README.rst', 'rt', encoding='utf8') as f:8+ readme = f.read()9 53-with open('flask/__init__.py', 'rb') as f:54- version = str(ast.literal_eval(_version_re.search(55- f.read().decode('utf-8')).group(1)))10+with io.open('flask/__init__.py', 'rt', encoding='utf8') as f:11+ version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)12 13 setup(14 name='Flask',15 version=version,60- url='https://github.com/pallets/flask/',16+ url='https://www.palletsprojects.com/p/flask/',17 license='BSD',18 author='Armin Ronacher',19 author_email='armin.ronacher@active-4.com',64- description='A microframework based on Werkzeug, Jinja2 '65- 'and good intentions',66- long_description=__doc__,20+ maintainer='Pallets team',21+ maintainer_email='contact@palletsprojects.com',22+ description='A simple framework for building complex web applications.',23+ long_description=readme,24 packages=['flask', 'flask.json'],25 include_package_data=True,26 zip_safe=False,27 platforms='any',71- python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',28 install_requires=[29 'Werkzeug>=0.14',30 'Jinja2>=2.10',31 'itsdangerous>=0.24',36 unmodified linesdeleted:test-requirements.txt-3 removed
1-tox2-pytest3-pytest-cov