docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
listlengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
raise exc_type, exc_value, tb.tb_next
<mask> except ImportError: <mask> exc_type, exc_value, tb = sys.exc_info() <mask> sys.modules.pop(fullname, None) <mask> if self.is_important_traceback(realname, tb): <mask> raise exc_type, exc_value, tb <mask> continu...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95c4dcb4d50e69b927855cd6a446579d2fe45b4e
scripts/flaskext_compat.py
setattr(sys.modules[self.wrapper_module], modname, module)
<mask> raise exc_type, exc_value, tb <mask> continue <mask> module = sys.modules[fullname] = sys.modules[realname] <mask> if '.' not in modname: <mask> setattr(ext_module, modname, module) <mask> return module <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95c4dcb4d50e69b927855cd6a446579d2fe45b4e
scripts/flaskext_compat.py
"""Walks a traceback's frames and checks if any of the frames originated in the given important module. If that is the case then we were able to import the module itself but apparently something went wrong when the module was imported. (Eg: import of an import failed). """
<mask> <mask> def is_important_traceback(self, important_module, tb): <mask> while tb is not None: <mask> if self.is_important_frame(important_module, tb): <mask> return True <mask> tb = tb.tb_next <mask> return False </s> Refactored flask.ext process...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95c4dcb4d50e69b927855cd6a446579d2fe45b4e
scripts/flaskext_compat.py
if self.is_important_frame(important_module, tb):
<mask> raise ImportError('No module named %s' % fullname) <mask> <mask> def is_important_traceback(self, important_module, tb): <mask> while tb is not None: <mask> if tb.tb_frame.f_globals.get('__name__') == important_module: <mask> return True <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95c4dcb4d50e69b927855cd6a446579d2fe45b4e
scripts/flaskext_compat.py
<mask> return False <mask> <mask> <mask> def activate(): <mask> """Activates the compatibility system.""" <mask> import flask <mask> if hasattr(flask, 'ext'): <mask> return <mask> sys.modules['flask.ext'] = flask.ext = ext_module <mask> sys.meta_path.append(_ExtensionImpo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95c4dcb4d50e69b927855cd6a446579d2fe45b4e
scripts/flaskext_compat.py
ext_module = imp.new_module('flask.ext') ext_module.__path__ = [] flask.ext = sys.modules['flask.ext'] = ext_module importer = ExtensionImporter(['flask_%s', 'flaskext.%s'], 'flask.ext') importer.install()
<mask> <mask> def activate(): <mask> """Activates the compatibility system.""" <mask> import flask <mask> if hasattr(flask, 'ext'): <mask> return <mask> sys.modules['flask.ext'] = flask.ext = ext_module <mask> sys.meta_path.append(_ExtensionImporter()) </s> Refactored flask.ext pro...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace" ]
https://github.com/pallets/flask/commit/95c4dcb4d50e69b927855cd6a446579d2fe45b4e
scripts/flaskext_compat.py
The minimal requirement for running the testsuite is ``pytest``. You can
<mask> <mask> You probably want to set up a `virtualenv <mask> <https://virtualenv.readthedocs.io/en/latest/index.html>`_. <mask> <mask> The minimal requirement for running the testsuite is ``py.test``. You can <mask> install it with:: <mask> <mask> pip install pytest <mask> <mask> Clone this reposit...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
CONTRIBUTING.rst
pytest
<mask> pip install --editable . <mask> <mask> Then you can run the testsuite with:: <mask> <mask> py.test <mask> <mask> With only py.test installed, a large part of the testsuite will get skipped <mask> though. Whether this is relevant depends on which part of Flask you're working <mask> on. Travi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
CONTRIBUTING.rst
With only pytest installed, a large part of the testsuite will get skipped
<mask> Then you can run the testsuite with:: <mask> <mask> py.test <mask> <mask> With only py.test installed, a large part of the testsuite will get skipped <mask> though. Whether this is relevant depends on which part of Flask you're working <mask> on. Travis is set up to run the full testsuite when you...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
CONTRIBUTING.rst
pytest --cov=flask tests/
<mask> pip install pytest-cov <mask> <mask> After this has been installed, you can output a report to the command line using this command:: <mask> <mask> py.test --cov=flask tests/ <mask> <mask> Generate a HTML report can be done using this command:: <mask> <mask> py.test --cov-report html --co...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
CONTRIBUTING.rst
pytest --cov-report html --cov=flask tests/
<mask> py.test --cov=flask tests/ <mask> <mask> Generate a HTML report can be done using this command:: <mask> <mask> py.test --cov-report html --cov=flask tests/ <mask> <mask> Full docs on ``coverage.py`` are here: https://coverage.readthedocs.io <mask> <mask> Caution <mask> ======= </s> py.test...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
CONTRIBUTING.rst
`pytest` testing tool:
<mask> ~ Where are the tests? <mask> <mask> Good that you're asking. The tests are in the <mask> tests/ folder. To run the tests use the <mask> `py.test` testing tool: <mask> <mask> $ py.test <mask> <mask> Details on contributing can be found in CONTRIBUTING.rst <mask>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
README
$ pytest
<mask> Good that you're asking. The tests are in the <mask> tests/ folder. To run the tests use the <mask> `py.test` testing tool: <mask> <mask> $ py.test <mask> <mask> Details on contributing can be found in CONTRIBUTING.rst <mask> <mask> ~ Where can I get help? <mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
README
pytest
<mask> <mask> Run and watch the tests pass, within the top-level :file:`flaskr/` <mask> directory as:: <mask> <mask> py.test <mask> <mask> Testing + setuptools <mask> -------------------- <mask> <mask> One way to handle testing is to integrate it with ``setuptools``. Here </s> py.test => pytest (#21...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
docs/tutorial/testing.rst
norecursedirs = .* *.egg *.egg-info env* artwork docs examples
<mask> [metadata] <mask> license_file = LICENSE <mask> <mask> [tool:pytest] <mask> norecursedirs = .* *.egg *.egg-info env* artwork docs </s> py.test => pytest (#2173) py.test => pytest </s> remove py.test --cov-report html --cov=flask tests/ </s> add pytest --cov-report html --cov=flask tests/ </s> re...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
setup.cfg
pytest --cov=flask --cov-report html []
<mask> # We need to install those after Flask is installed. <mask> pip install -e examples/flaskr <mask> pip install -e examples/minitwit <mask> pip install -e examples/patterns/largerapp <mask> py.test --cov=flask --cov-report html [] <mask> deps= <mask> pytest <mask> pytest-cov <m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/95db82f8f7df0acce7051a8dedf29b88e436f5ab
tox.ini
# since we only establish the entry in sys.modules at the # very this seems to be redundant, but if recursive imports # happen we will call into the move import a second time. # On the second invocation we still don't have an entry for # fu...
<mask> except ImportError: <mask> exc_type, exc_value, tb = exc_info() <mask> if self.is_important_traceback(realname, tb): <mask> raise exc_type, exc_value, tb <mask> continue <mask> module = modules[fullname] = modules[r...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9691b7f0bf70553e61a88c8c7b6ffcac776b8d26
flask/ext/__init__.py
from __future__ import with_statement
<mask> :license: BSD, see LICENSE for more details. <mask> """ <mask> import sys <mask> import unittest <mask> from flask.testsuite import FlaskTestCase <mask> <mask> <mask> class ExtImportHookTestCase(FlaskTestCase): </s> Deal with partially setup packages in the redirect hook. </s> remove locations...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9691b7f0bf70553e61a88c8c7b6ffcac776b8d26
flask/testsuite/ext.py
def test_flaskext_broken_package_no_module_caching(self): for x in xrange(2): with self.assert_raises(ImportError): import flask.ext.broken
<mask> self.assert_equal(test_function(), 42) <mask> <mask> <mask> def suite(): <mask> suite = unittest.TestSuite() <mask> suite.addTest(unittest.makeSuite(ExtImportHookTestCase)) <mask> return suite </s> Deal with partially setup packages in the redirect hook. </s> remove """Walks...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9691b7f0bf70553e61a88c8c7b6ffcac776b8d26
flask/testsuite/ext.py
locations. For implementation details see the code in Flask 0.8 that does the same.
<mask> <mask> <mask> class _ExtensionImporter(object): <mask> """This importer redirects imports from the flask.ext module to other <mask> locations. <mask> """ <mask> _module_choices = ['flask_%s', 'flaskext.%s'] <mask> prefix = ext_module.__name__ + '.' <mask> prefix_cutoff = prefix...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9691b7f0bf70553e61a88c8c7b6ffcac776b8d26
scripts/flaskext_compat.py
sys.modules.pop(fullname, None)
<mask> try: <mask> __import__(realname) <mask> except ImportError: <mask> exc_type, exc_value, tb = sys.exc_info() <mask> if self.is_important_traceback(realname, tb): <mask> raise exc_type, exc_value, tb <mask> ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9691b7f0bf70553e61a88c8c7b6ffcac776b8d26
scripts/flaskext_compat.py
<mask> return module <mask> raise ImportError('No module named %s' % fullname) <mask> <mask> def is_important_traceback(self, important_module, tb): <mask> """Walks a traceback's frames and checks if any of the frames <mask> originated in the given important module. If th...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9691b7f0bf70553e61a88c8c7b6ffcac776b8d26
scripts/flaskext_compat.py
if self.app.config['EXPLAIN_TEMPLATE_LOADING']: return self._get_source_explained(environment, template) return self._get_source_fast(environment, template) def _get_source_explained(self, environment, template):
<mask> def __init__(self, app): <mask> self.app = app <mask> <mask> def get_source(self, environment, template): <mask> explain = self.app.config['EXPLAIN_TEMPLATE_LOADING'] <mask> attempts = [] <mask> tmplrv = None <mask> <mask> for srcobj, loader in self._ite...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96ec24f6e0ff77a24d0151afe20ec7c97118019f
flask/templating.py
trv = None
<mask> <mask> def get_source(self, environment, template): <mask> explain = self.app.config['EXPLAIN_TEMPLATE_LOADING'] <mask> attempts = [] <mask> tmplrv = None <mask> <mask> for srcobj, loader in self._iter_loaders(template): <mask> try: <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96ec24f6e0ff77a24d0151afe20ec7c97118019f
flask/templating.py
if trv is None: trv = rv
<mask> <mask> for srcobj, loader in self._iter_loaders(template): <mask> try: <mask> rv = loader.get_source(environment, template) <mask> if tmplrv is None: <mask> tmplrv = rv <mask> if not explain: <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96ec24f6e0ff77a24d0151afe20ec7c97118019f
flask/templating.py
from .debughelpers import explain_template_loading_attempts explain_template_loading_attempts(self.app, template, attempts) if trv is not None: return trv raise TemplateNotFound(template)
<mask> except TemplateNotFound: <mask> rv = None <mask> attempts.append((loader, srcobj, rv)) <mask> <mask> if explain: <mask> from .debughelpers import explain_template_loading_attempts <mask> explain_template_loading_attempts(self.app, te...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96ec24f6e0ff77a24d0151afe20ec7c97118019f
flask/templating.py
def _get_source_fast(self, environment, template): for srcobj, loader in self._iter_loaders(template): try: return loader.get_source(environment, template) except TemplateNotFound: continue
<mask> if explain: <mask> from .debughelpers import explain_template_loading_attempts <mask> explain_template_loading_attempts(self.app, template, attempts) <mask> <mask> if tmplrv is not None: <mask> return tmplrv <mask> raise TemplateNotFound(templat...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96ec24f6e0ff77a24d0151afe20ec7c97118019f
flask/templating.py
redbaron = pytest.importorskip("redbaron")
<mask> # Tester for the flaskext_migrate.py module located in flask/scripts/ <mask> # <mask> # Author: Keyan Pishdadian <mask> import pytest <mask> from redbaron import RedBaron <mask> import flaskext_migrate as migrate <mask> <mask> <mask> def test_simple_from_import(): <mask> red = RedBaron("from flas...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("from flask.ext import foo")
<mask> import flaskext_migrate as migrate <mask> <mask> <mask> def test_simple_from_import(): <mask> red = RedBaron("from flask.ext import foo") <mask> output = migrate.fix_tester(red) <mask> assert output == "import flask_foo as foo" <mask> <mask> <mask> def test_from_to_from_import(): </s> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("from flask.ext.foo import bar")
<mask> assert output == "import flask_foo as foo" <mask> <mask> <mask> def test_from_to_from_import(): <mask> red = RedBaron("from flask.ext.foo import bar") <mask> output = migrate.fix_tester(red) <mask> assert output == "from flask_foo import bar as bar" <mask> <mask> <mask> def test_mul...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("from flask.ext.foo import bar, foobar, something")
<mask> assert output == "from flask_foo import bar as bar" <mask> <mask> <mask> def test_multiple_import(): <mask> red = RedBaron("from flask.ext.foo import bar, foobar, something") <mask> output = migrate.fix_tester(red) <mask> assert output == "from flask_foo import bar, foobar, something" <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("from flask.ext.foo import \
<mask> assert output == "from flask_foo import bar, foobar, something" <mask> <mask> <mask> def test_multiline_import(): <mask> red = RedBaron("from flask.ext.foo import \ <mask> bar,\ <mask> foobar,\ <mask> something") <mask> output = m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("import flask.ext.foo")
<mask> assert output == "from flask_foo import bar, foobar, something" <mask> <mask> <mask> def test_module_import(): <mask> red = RedBaron("import flask.ext.foo") <mask> output = migrate.fix_tester(red) <mask> assert output == "import flask_foo" <mask> <mask> <mask> def test_named_module_...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("import flask.ext.foo as foobar")
<mask> assert output == "import flask_foo" <mask> <mask> <mask> def test_named_module_import(): <mask> red = RedBaron("import flask.ext.foo as foobar") <mask> output = migrate.fix_tester(red) <mask> assert output == "import flask_foo as foobar" <mask> <mask> <mask> def test_named_from_impo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("from flask.ext.foo import bar as baz")
<mask> assert output == "import flask_foo as foobar" <mask> <mask> <mask> def test_named_from_import(): <mask> red = RedBaron("from flask.ext.foo import bar as baz") <mask> output = migrate.fix_tester(red) <mask> assert output == "from flask_foo import bar as baz" <mask> <mask> <mask> def ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("from flask.ext.foo import (bar, foo, foobar)")
<mask> assert output == "from flask_foo import bar as baz" <mask> <mask> <mask> def test_parens_import(): <mask> red = RedBaron("from flask.ext.foo import (bar, foo, foobar)") <mask> output = migrate.fix_tester(red) <mask> assert output == "from flask_foo import (bar, foo, foobar)" <mask> <m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("flask.ext.foo(var)")
<mask> assert output == "from flask_foo import (bar, foo, foobar)" <mask> <mask> <mask> def test_function_call_migration(): <mask> red = RedBaron("flask.ext.foo(var)") <mask> output = migrate.fix_tester(red) <mask> assert output == "flask_foo(var)" <mask> <mask> <mask> def test_nested_func...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("import flask.ext.foo\n\n"
<mask> assert output == "flask_foo(var)" <mask> <mask> <mask> def test_nested_function_call_migration(): <mask> red = RedBaron("import flask.ext.foo\n\n" <mask> "flask.ext.foo.bar(var)") <mask> output = migrate.fix_tester(red) <mask> assert output == ("import flask_foo\n\n" ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
red = redbaron.RedBaron("from flask import Flask")
<mask> "flask_foo.bar(var)") <mask> <mask> <mask> def test_no_change_to_import(): <mask> red = RedBaron("from flask import Flask") <mask> output = migrate.fix_tester(red) <mask> assert output == "from flask import Flask" </s> Skip test if redbaron is not installed </s> remove...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep" ]
https://github.com/pallets/flask/commit/96f7b07caf15a23a67e9e9dfd086d38e400b2db5
scripts/test_import_migration.py
- The :func:`flask.Request.on_json_loading_failed` now returns a JSON formatted response by default.
<mask> <mask> Relase date to be decided, codename to be chosen. <mask> <mask> - The :func:`flask.url_for` function now can generate anchors to the <mask> generated links. <mask> - The :func:`flask.url_for` function now can also explicitly generate <mask> URL rules specific to a given HTTP method. <mask> -...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9711fd402010b2e14a98879f0457174c3ca15a24
CHANGES
def test_json_bad_requests_content_type(self): app = flask.Flask(__name__) @app.route('/json', methods=['POST']) def return_json(): return unicode(flask.request.json) c = app.test_client() rv = c.post('/json', data='malformed', content_type='application/json') ...
<mask> rv = c.post('/json', data='malformed', content_type='application/json') <mask> self.assert_equal(rv.status_code, 400) <mask> <mask> def test_json_body_encoding(self): <mask> app = flask.Flask(__name__) <mask> app.testing = True <mask> @app.route('/') </s> On J...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9711fd402010b2e14a98879f0457174c3ca15a24
flask/testsuite/helpers.py
from werkzeug.exceptions import BadRequest, HTTPException
<mask> :license: BSD, see LICENSE for more details. <mask> """ <mask> <mask> from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase <mask> from werkzeug.exceptions import BadRequest <mask> from werkzeug.utils import cached_property <mask> <mask> from .debughelpers import attach_enc...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9711fd402010b2e14a98879f0457174c3ca15a24
flask/wrappers.py
this method is used by :attr:`json` when an error ocurred. The default implementation raises a :class:`JSONBadRequest`, which is a subclass of :class:`~werkzeug.exceptions.BadRequest` which sets the ``Content-Type`` to ``application/json`` and provides a JSON-formatted error des...
<mask> return self.on_json_loading_failed(e) <mask> <mask> def on_json_loading_failed(self, e): <mask> """Called if decoding of the JSON data failed. The return value of <mask> this method is used by :attr:`json` when an error ocurred. The <mask> default implementati...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9711fd402010b2e14a98879f0457174c3ca15a24
flask/wrappers.py
raise JSONBadRequest()
<mask> default implementation raises a :class:`~werkzeug.exceptions.BadRequest`. <mask> <mask> .. versionadded:: 0.8 <mask> """ <mask> raise BadRequest() <mask> <mask> def _load_form_data(self): <mask> RequestBase._load_form_data(self) <mask> <mask> # in ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9711fd402010b2e14a98879f0457174c3ca15a24
flask/wrappers.py
builder = EnvironBuilder(self, *args, **kwargs)
<mask> :class:`~werkzeug.test.EnvironBuilder`. <mask> """ <mask> from flask.testing import make_test_environ_builder <mask> <mask> builder = make_test_environ_builder(self, *args, **kwargs) <mask> <mask> try: <mask> return self.request_context(builder.ge...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
flask/app.py
if url.query: sep = b"?" if isinstance(url.query, bytes) else "?" path += sep + url.query
<mask> assert not (base_url or subdomain or url_scheme) or (base_url is not None) != bool( <mask> subdomain or url_scheme <mask> ), 'Cannot pass "subdomain" or "url_scheme" with "base_url".' <mask> <mask> if base_url is None: <mask> http_host = app.config.get("SERVER_NAME") or "localh...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
flask/testing.py
def make_test_environ_builder(*args, **kwargs): """Create a :class:`flask.testing.EnvironBuilder`.
<mask> if "json" in kwargs: <mask> assert "data" not in kwargs, "Client cannot provide both 'json' and 'data'." <mask> kwargs["data"] = json_dumps(kwargs.pop("json"), app=app) <mask> <mask> if "content_type" not in kwargs: <mask> kwargs["content_type"] = "application/json"...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
flask/testing.py
.. deprecated: 1.1 Will be removed in 1.2. Construct ``flask.testing.EnvironBuilder`` directly instead. """ warnings.warn( DeprecationWarning( '"make_test_environ_builder()" is deprecated and will be removed ' 'in 1.2. Construct "flask.testing.EnvironBuilder" ...
<mask> <mask> if "content_type" not in kwargs: <mask> kwargs["content_type"] = "application/json" <mask> <mask> return EnvironBuilder(path, base_url, *args, **kwargs) <mask> <mask> <mask> class FlaskClient(Client): <mask> """Works like a regular Werkzeug test client but has some...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
flask/testing.py
and isinstance(args[0], (werkzeug.test.EnvironBuilder, dict))
<mask> <mask> if ( <mask> not kwargs <mask> and len(args) == 1 <mask> and isinstance(args[0], (EnvironBuilder, dict)) <mask> ): <mask> environ = self.environ_base.copy() <mask> <mask> if isinstance(args[0], EnvironBuilder): <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
flask/testing.py
if isinstance(args[0], werkzeug.test.EnvironBuilder):
<mask> and isinstance(args[0], (EnvironBuilder, dict)) <mask> ): <mask> environ = self.environ_base.copy() <mask> <mask> if isinstance(args[0], EnvironBuilder): <mask> environ.update(args[0].get_environ()) <mask> else: <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
flask/testing.py
builder = EnvironBuilder(self.application, *args, **kwargs)
<mask> kwargs.setdefault("environ_overrides", {})[ <mask> "flask._preserve_context" <mask> ] = self.preserve_context <mask> kwargs.setdefault("environ_base", self.environ_base) <mask> builder = make_test_environ_builder(self.application, *args, **kwar...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
flask/testing.py
from flask.testing import EnvironBuilder
<mask> # We cannot use app.test_client() for the Unicode-rich Host header, <mask> # because werkzeug enforces latin1 on Python 2. <mask> # However it works when actually passed to the server. <mask> <mask> from flask.testing import make_test_environ_builder <mask> <mask> builder = make_test...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
tests/test_reqctx.py
builder = EnvironBuilder(app)
<mask> # However it works when actually passed to the server. <mask> <mask> from flask.testing import make_test_environ_builder <mask> <mask> builder = make_test_environ_builder(app) <mask> environ = builder.get_environ() <mask> <mask> # use a non-printable character in the Host - this is...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
tests/test_reqctx.py
from flask.testing import EnvironBuilder
<mask> # We cannot use app.test_client() for the Unicode-rich Host header, <mask> # because werkzeug enforces latin1 on Python 2. <mask> # However it works when actually passed to the server. <mask> <mask> from flask.testing import make_test_environ_builder <mask> <mask> builder = make_test...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
tests/test_reqctx.py
from flask.testing import make_test_environ_builder, FlaskCliRunner, EnvironBuilder
<mask> from flask import appcontext_popped <mask> from flask._compat import text_type <mask> from flask.cli import ScriptInfo <mask> from flask.json import jsonify <mask> from flask.testing import make_test_environ_builder, FlaskCliRunner <mask> <mask> try: <mask> import blinker <mask> except ImportError:...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
tests/test_testing.py
builder = EnvironBuilder(app, path="/index", method="GET")
<mask> @app.route("/index") <mask> def index(): <mask> return flask.request.remote_addr <mask> <mask> builder = make_test_environ_builder(app, path="/index", method="GET") <mask> request.addfinalizer(builder.close) <mask> <mask> rv = client.open(builder) <mask> assert rv.data ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
tests/test_testing.py
eb = EnvironBuilder(app, "https://example.com/")
<mask> assert rv.data == b"https://localhost/" <mask> <mask> <mask> def test_path_is_url(app): <mask> eb = make_test_environ_builder(app, "https://example.com/") <mask> assert eb.url_scheme == "https" <mask> assert eb.host == "example.com" <mask> assert eb.script_root == "" <mask> ass...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/976dfedaa9efdb566333ea829b12751820268f67
tests/test_testing.py
- Add support for ``provide_automatic_options`` in ``add_url_rule`` to disable adding OPTIONS method when the ``view_func`` argument is not a class. (`#1489`_).
<mask> - Pass ``_scheme`` argument from ``url_for`` to ``handle_build_error``. <mask> (`#2017`_) <mask> <mask> .. _#1489: https://github.com/pallets/flask/pull/1489 <mask> .. _#2017: https://github.com/pallets/flask/pull/2017 <mask> .. _#2223: https://github.com/pallets/flask/pull/2223 <mask> <mask> Version...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/97e2cd0a5a5f2b663d7a82edbaede2fe2cfb0679
CHANGES
.. _#1489: https://github.com/pallets/flask/pull/1489
<mask> - Add support for ``provide_automatic_options`` in ``add_url_rule`` to disable <mask> adding OPTIONS method when the ``view_func`` argument is not a class. <mask> (`#1489`_). <mask> <mask> .. _#2017: https://github.com/pallets/flask/pull/2017 <mask> .. _#2223: https://github.com/pallets/flask/pull/222...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/97e2cd0a5a5f2b663d7a82edbaede2fe2cfb0679
CHANGES
<mask> - Allow custom Jinja environment subclasses (pull request ``#1422``). <mask> - ``flask.g`` now has ``pop()`` and ``setdefault`` methods. <mask> - Turn on autoescape for ``flask.templating.render_template_string`` by default <mask> (pull request ``#1515``). <mask> - Added support for `provide_automatic_opt...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/97e2cd0a5a5f2b663d7a82edbaede2fe2cfb0679
CHANGES
def add_url_rule(self, rule, endpoint=None, view_func=None, provide_automatic_options=None, **options):
<mask> """ <mask> return iter(self._blueprint_order) <mask> <mask> @setupmethod <mask> def add_url_rule(self, rule, endpoint=None, view_func=None, <mask> provide_automatic_options=None, **options): <mask> """Connects a URL rule. Works exactly like the :meth:...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/97e2cd0a5a5f2b663d7a82edbaede2fe2cfb0679
flask/app.py
:param provide_automatic_options: controls whether the ``OPTIONS`` method should be added automatically. This can also be controlled by setting the ``view_func.provide_automatic_options = False`` before adding the rule.
<mask> itself assumes the name of the view function as <mask> endpoint <mask> :param view_func: the function to call when serving a request to the <mask> provided endpoint <mask> :param provide_automatic_options: controls w...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/97e2cd0a5a5f2b663d7a82edbaede2fe2cfb0679
flask/app.py
def test_provide_automatic_options_attr():
<mask> rv = app.test_client().open('/', method='OPTIONS') <mask> assert sorted(rv.allow) == ['GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'] <mask> <mask> <mask> def test_options_handling_disabled(): <mask> app = flask.Flask(__name__) <mask> <mask> def index(): <mask> return 'Hello World!' ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/97e2cd0a5a5f2b663d7a82edbaede2fe2cfb0679
tests/test_basic.py
<mask> monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock) <mask> app = flask.Flask(__name__) <mask> app.config['SERVER_NAME'] = 'pocoo.org:8080' <mask> app.run(host, port) <mask> <mask> <mask> def test_disable_automatic_options(): <mask> # Issue 1488: Add support for a kw...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/pallets/flask/commit/97e2cd0a5a5f2b663d7a82edbaede2fe2cfb0679
tests/test_basic.py
cfgv==3.3.0
<mask> blinker==1.4 <mask> # via -r requirements/tests.in <mask> certifi==2020.12.5 <mask> # via requests <mask> cfgv==3.2.0 <mask> # via pre-commit <mask> chardet==4.0.0 <mask> # via requests <mask> click==8.0.0 <mask> # via pip-tools </s> update pallets and sphinx requirements </s> remo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/dev.txt
click==8.0.1
<mask> cfgv==3.2.0 <mask> # via pre-commit <mask> chardet==4.0.0 <mask> # via requests <mask> click==8.0.0 <mask> # via pip-tools <mask> distlib==0.3.1 <mask> # via virtualenv <mask> docutils==0.16 <mask> # via </s> update pallets and sphinx requirements </s> remove cfgv==3.2.0 </s> add ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/dev.txt
jinja2==3.0.1
<mask> imagesize==1.2.0 <mask> # via sphinx <mask> iniconfig==1.1.1 <mask> # via pytest <mask> jinja2==3.0.0 <mask> # via sphinx <mask> markupsafe==2.0.0 <mask> # via jinja2 <mask> mypy-extensions==0.4.3 <mask> # via mypy </s> update pallets and sphinx requirements </s> remove markupsafe=...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/dev.txt
markupsafe==2.0.1
<mask> iniconfig==1.1.1 <mask> # via pytest <mask> jinja2==3.0.0 <mask> # via sphinx <mask> markupsafe==2.0.0 <mask> # via jinja2 <mask> mypy-extensions==0.4.3 <mask> # via mypy <mask> mypy==0.812 <mask> # via -r requirements/typing.in </s> update pallets and sphinx requirements </s> remo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/dev.txt
sphinx==4.0.2
<mask> sphinx-issues==1.2.0 <mask> # via -r requirements/docs.in <mask> sphinx-tabs==3.0.0 <mask> # via -r requirements/docs.in <mask> git+https://github.com/sphinx-doc/sphinx.git@96dbe5e3 <mask> # via <mask> # -r requirements/docs.in <mask> # pallets-sphinx-themes <mask> # sphinx...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/dev.txt
Sphinx
<mask> Pallets-Sphinx-Themes <mask> git+https://github.com/sphinx-doc/sphinx.git@96dbe5e3 # https://github.com/sphinx-doc/sphinx/issues/921 <mask> sphinx-issues <mask> sphinxcontrib-log-cabinet <mask> sphinx-tabs </s> update pallets and sphinx requirements </s> remove git+https://github.com/sphinx-doc/sphinx.git...
[ "keep", "replace", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/docs.in
jinja2==3.0.1
<mask> idna==2.10 <mask> # via requests <mask> imagesize==1.2.0 <mask> # via sphinx <mask> jinja2==3.0.0 <mask> # via sphinx <mask> markupsafe==2.0.0 <mask> # via jinja2 <mask> packaging==20.9 <mask> # via </s> update pallets and sphinx requirements </s> remove markupsafe==2.0.0 </s> add...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/docs.txt
markupsafe==2.0.1
<mask> imagesize==1.2.0 <mask> # via sphinx <mask> jinja2==3.0.0 <mask> # via sphinx <mask> markupsafe==2.0.0 <mask> # via jinja2 <mask> packaging==20.9 <mask> # via <mask> # pallets-sphinx-themes <mask> # sphinx </s> update pallets and sphinx requirements </s> remove jinja2==3.0....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/docs.txt
sphinx==4.0.2
<mask> sphinx-issues==1.2.0 <mask> # via -r requirements/docs.in <mask> sphinx-tabs==3.0.0 <mask> # via -r requirements/docs.in <mask> git+https://github.com/sphinx-doc/sphinx.git@96dbe5e3 <mask> # via <mask> # -r requirements/docs.in <mask> # pallets-sphinx-themes <mask> # sphinx...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9889ca8bcabbb1b1290ca4403b0242e01bae4c47
requirements/docs.txt
For implementing HTTPS on your server.
<mask> <mask> SSL/HTTPS <mask> --------- <mask> <mask> For implementing HTTPS on your server <mask> <mask> Below some packages in suggestion order that implements this protocol: <mask> <mask> * `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_ <mask> * `flask-sslify <https://github...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
Below are some packages that implement this protocol:
<mask> --------- <mask> <mask> For implementing HTTPS on your server <mask> <mask> Below some packages in suggestion order that implements this protocol: <mask> <mask> * `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_ <mask> * `flask-sslify <https://github.com/kennethreitz/flask-ssl...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
Prevents the client from clicking page elements outside of the website, avoiding hijacking or UI redress attacks.
<mask> ------------------------------------------------------------------------------------------------------------------------- <mask> <mask> <mask> .. sourcecode:: html <mask> <mask> X-Frame-Options: DENY <mask> X-Frame-Options: SAMEORIGIN <mask> X-Frame-Options: ALLOW-FROM https://example.com...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
See also `X-Frame-Options <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options>`_.
<mask> X-Frame-Options: DENY <mask> X-Frame-Options: SAMEORIGIN <mask> X-Frame-Options: ALLOW-FROM https://example.com/ <mask> <mask> To learn more check `this <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security>`_ <mask> <mask> * `flask-talisman <https://github.com...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
Prevents XSS by blocking requests on clients and forcing them to read the content type instead of first opening it.
<mask> <mask> `X-Content-Type-Options <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options>`_ <mask> ------------------------------------------------------------------------------------------------------------- <mask> <mask> Prevents XSS by blocking requests on clients and forcing th...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
See also `X-Content-Type-Options <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options>`_.
<mask> .. sourcecode:: html <mask> <mask> X-Content-Type-Options: nosniff <mask> <mask> To learn more check `this <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options>`_ <mask> <mask> <mask> * `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_ <ma...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
For setting cookies on client-side storage.
<mask> <mask> `Cookie options <https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Secure_and_HttpOnly_cookies>`_ <mask> ---------------------------------------------------------------------------------------------------------- <mask> <mask> For setting cookies on client-side storage <mask> <mask> Examp...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
Example:
<mask> ---------------------------------------------------------------------------------------------------------- <mask> <mask> For setting cookies on client-side storage <mask> <mask> Example <mask> <mask> .. sourcecode:: html <mask> <mask> Set-Cookie: [cookie-name]=[cookie-value] <mask> </s> Fi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
See also `HTTP cookies <https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Secure_and_HttpOnly_cookies>`_ .
<mask> .. sourcecode:: html <mask> <mask> Set-Cookie: [cookie-name]=[cookie-value] <mask> <mask> To learn more check `this <https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Secure_and_HttpOnly_cookies>`_ <mask> <mask> * `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_ ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
For associating clients with web servers through a certificate key and prevent MITM attacks.
<mask> <mask> `HTTP Public Key Pinning <https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning>`_ (HPKP) <mask> ------------------------------------------------------------------------------------------------------- <mask> <mask> For associating clients with web servers throught a certificate key a...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
Example:
<mask> ------------------------------------------------------------------------------------------------------- <mask> <mask> For associating clients with web servers throught a certificate key and prevent MITM attacks <mask> <mask> Example <mask> <mask> .. sourcecode:: html <mask> <mask> Public-Key-Pins...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
See also `Public Key Pinning <https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning>`_.
<mask> .. sourcecode:: html <mask> <mask> Public-Key-Pins: pin-sha256="base64=="; max-age=expireTime [; includeSubDomains][; report-uri="reportURI"] <mask> <mask> To learn more check `this <https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning>`_ <mask> <mask> * `flask-talisman <https://gi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
References
<mask> <mask> * `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_ <mask> * `flask-secure-headers <https://github.com/twaldear/flask-secure-headers>`_ <mask> <mask> References: <mask> ----------- <mask> <mask> * https://docs.djangoproject.com/en/1.11/topics/security/ <mask> * https://...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/98b0f96a9820d6314cd814d27b25589ac08ccbf4
docs/security.rst
it here in detail (see :class:`~flask.Request`). Here is a broad overview of
<mask> The Request Object <mask> `````````````````` <mask> <mask> The request object is documented in the API section and we will not cover <mask> it here in detail (see :class:`~flask.request`). Here is a broad overview of <mask> some of the most common operations. First of all you have to import it from <mas...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9900a72fe7992d873915af68f7d52148e738d032
docs/quickstart.rst
:attr:`~flask.Request.method` attribute. To access form data (data
<mask> <mask> from flask import request <mask> <mask> The current request method is available by using the <mask> :attr:`~flask.request.method` attribute. To access form data (data <mask> transmitted in a ``POST`` or ``PUT`` request) you can use the <mask> :attr:`~flask.request.form` attribute. Here is a...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9900a72fe7992d873915af68f7d52148e738d032
docs/quickstart.rst
:attr:`~flask.Request.form` attribute. Here is a full example of the two
<mask> <mask> The current request method is available by using the <mask> :attr:`~flask.request.method` attribute. To access form data (data <mask> transmitted in a ``POST`` or ``PUT`` request) you can use the <mask> :attr:`~flask.request.form` attribute. Here is a full example of the two <mask> attributes men...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9900a72fe7992d873915af68f7d52148e738d032
docs/quickstart.rst
:attr:`~flask.Request.args` attribute::
<mask> error page is shown instead. So for many situations you don't have to <mask> deal with that problem. <mask> <mask> To access parameters submitted in the URL (``?key=value``) you can use the <mask> :attr:`~flask.request.args` attribute:: <mask> <mask> searchword = request.args.get('key', '') <mask>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9900a72fe7992d873915af68f7d52148e738d032
docs/quickstart.rst
to the :class:`~flask.Request` documentation.
<mask> :exc:`KeyError` because users might change the URL and presenting them a 400 <mask> bad request page in that case is not user friendly. <mask> <mask> For a full list of methods and attributes of the request object, head over <mask> to the :class:`~flask.request` documentation. <mask> <mask> <mask> Fil...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9900a72fe7992d873915af68f7d52148e738d032
docs/quickstart.rst
- because the Python standard library caches loggers, the name of the logger is configurable now to better support unittests.
<mask> - test client has not the ability to preserve the request context <mask> for a little longer. This can also be used to trigger custom <mask> requests that do not pop the request stack for testing. <mask> <mask> Version 0.3.1 <mask> ------------- <mask> </s> Fixed after_request handlers being calle...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
CHANGES
from threading import Lock
<mask> from datetime import datetime, timedelta <mask> <mask> from itertools import chain <mask> from jinja2 import Environment, PackageLoader, FileSystemLoader <mask> from werkzeug import Request as RequestBase, Response as ResponseBase, \ <mask> LocalStack, LocalProxy, create_environ, SharedDataMiddleware...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
flask.py
# a lock used for logger initialization _logger_lock = Lock()
<mask> pkg_resources = None <mask> <mask> <mask> class Request(RequestBase): <mask> """The request object used by default in flask. Remembers the <mask> matched endpoint and view arguments. <mask> </s> Fixed after_request handlers being called twice in some cases and improved logging system </s>...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
flask.py
#: the name of the logger to use. By default the logger name is the #: package name passed to the constructor. #: #: .. versionadded:: 0.4 logger_name = ConfigAttribute('LOGGER_NAME')
<mask> #: `USE_X_SENDFILE` configuration key. Defaults to `False`. <mask> use_x_sendfile = ConfigAttribute('USE_X_SENDFILE') <mask> <mask> #: the logging format used for the debug logger. This is only used when <mask> #: the application is in debug mode, otherwise the attached logging <mask> ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
flask.py
'USE_X_SENDFILE': False, 'LOGGER_NAME': None
<mask> 'DEBUG': False, <mask> 'SECRET_KEY': None, <mask> 'SESSION_COOKIE_NAME': 'session', <mask> 'PERMANENT_SESSION_LIFETIME': timedelta(days=31), <mask> 'USE_X_SENDFILE': ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
flask.py
#: prepare the deferred setup of the logger self._logger = None self.logger_name = self.import_name
<mask> #: to load a config from files. <mask> self.config = Config(self.root_path, self.default_config) <mask> <mask> #: a dictionary of all view functions registered. The keys will <mask> #: be function names which are also used to generate URLs and <mask> #: the values ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
flask.py
@property
<mask> get_flashed_messages=get_flashed_messages <mask> ) <mask> self.jinja_env.filters['tojson'] = _tojson_filter <mask> <mask> @cached_property <mask> def logger(self): <mask> """A :class:`logging.Logger` object for this application. The <mask> default con...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
flask.py
if self._logger and self._logger.name == self.logger_name: return self._logger with _logger_lock: if self._logger and self._logger.name == self.logger_name: return self._logger from logging import getLogger, StreamHandler, Formatter, DEBUG ...
<mask> app.logger.error('An error occoured') <mask> <mask> .. versionadded:: 0.3 <mask> """ <mask> from logging import getLogger, StreamHandler, Formatter, DEBUG <mask> class DebugHandler(StreamHandler): <mask> def emit(x, record): <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
flask.py
except Exception, e: response = self.make_response(self.handle_exception(e)) try:
<mask> rv = self.dispatch_request() <mask> response = self.make_response(rv) <mask> response = self.process_response(response) <mask> except Exception, e: <mask> response = self.make_response(self.handle_exception(e)) <mask> ...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/pallets/flask/commit/9983e847425621b5e474ae9da6822f1af0b0cc1f
flask.py