Update upstream source from tag 'upstream/0.16.1+dfsg1'
Update to upstream version '0.16.1+dfsg1'
with Debian dir 11f72dfde0097e04e27032a4c828376839eae1d4
Ondřej Nový
4 years ago
3 | 3 | |
4 | 4 | variables: |
5 | 5 | vmImage: ubuntu-latest |
6 | python.version: 3.7 | |
6 | python.version: '3.8' | |
7 | 7 | TOXENV: py,coverage-ci |
8 | hasTestResults: true | |
8 | hasTestResults: 'true' | |
9 | 9 | |
10 | 10 | strategy: |
11 | 11 | matrix: |
12 | Python 3.7 Linux: | |
12 | Python 3.8 Linux: | |
13 | 13 | vmImage: ubuntu-latest |
14 | Python 3.7 Windows: | |
14 | Python 3.8 Windows: | |
15 | 15 | vmImage: windows-latest |
16 | Python 3.7 Mac: | |
16 | Python 3.8 Mac: | |
17 | 17 | vmImage: macos-latest |
18 | 18 | PyPy 3 Linux: |
19 | 19 | python.version: pypy3 |
20 | Python 3.7 Linux: | |
21 | python.version: '3.7' | |
20 | 22 | Python 3.6 Linux: |
21 | python.version: 3.6 | |
23 | python.version: '3.6' | |
22 | 24 | Python 3.5 Linux: |
23 | python.version: 3.5 | |
25 | python.version: '3.5' | |
24 | 26 | Python 2.7 Linux: |
25 | python.version: 2.7 | |
27 | python.version: '2.7' | |
26 | 28 | Python 2.7 Windows: |
27 | python.version: 2.7 | |
29 | python.version: '2.7' | |
28 | 30 | vmImage: windows-latest |
29 | 31 | Docs: |
30 | TOXENV: docs-html | |
31 | hasTestResults: false | |
32 | TOXENV: docs | |
33 | hasTestResults: 'false' | |
32 | 34 | Style: |
33 | 35 | TOXENV: style |
34 | hasTestResults: false | |
36 | hasTestResults: 'false' | |
35 | 37 | |
36 | 38 | pool: |
37 | 39 | vmImage: $[ variables.vmImage ] |
0 | 0 | repos: |
1 | 1 | - repo: https://github.com/asottile/reorder_python_imports |
2 | rev: v1.4.0 | |
2 | rev: v1.8.0 | |
3 | 3 | hooks: |
4 | 4 | - id: reorder-python-imports |
5 | 5 | name: Reorder Python imports (src, tests) |
10 | 10 | files: "^examples/" |
11 | 11 | args: ["--application-directories", "examples"] |
12 | 12 | - repo: https://github.com/ambv/black |
13 | rev: 18.9b0 | |
13 | rev: 19.10b0 | |
14 | 14 | hooks: |
15 | 15 | - id: black |
16 | 16 | - repo: https://gitlab.com/pycqa/flake8 |
17 | rev: 3.7.7 | |
17 | rev: 3.7.9 | |
18 | 18 | hooks: |
19 | 19 | - id: flake8 |
20 | 20 | additional_dependencies: [flake8-bugbear] |
21 | 21 | - repo: https://github.com/pre-commit/pre-commit-hooks |
22 | rev: v2.1.0 | |
22 | rev: v2.4.0 | |
23 | 23 | hooks: |
24 | 24 | - id: check-byte-order-marker |
25 | 25 | - id: trailing-whitespace |
0 | 0 | .. currentmodule:: werkzeug |
1 | ||
2 | Version 0.16.1 | |
3 | -------------- | |
4 | ||
5 | Released 2020-01-27 | |
6 | ||
7 | - Fix import location in deprecation messages for subpackages. | |
8 | :issue:`1663` | |
9 | - Fix an SSL error on Python 3.5 when the dev server responds with no | |
10 | content. :issue:`1659` | |
11 | ||
1 | 12 | |
2 | 13 | Version 0.16.0 |
3 | 14 | -------------- |
67 | 67 | There is also the codecs module which provides an open function that decodes |
68 | 68 | automatically from the given encoding. |
69 | 69 | |
70 | ||
70 | 71 | Error Handling |
71 | 72 | ============== |
72 | 73 | |
73 | With Werkzeug 0.3 onwards you can further control the way Werkzeug works with | |
74 | unicode. In the past Werkzeug ignored encoding errors silently on incoming | |
75 | data. This decision was made to avoid internal server errors if the user | |
76 | tampered with the submitted data. However there are situations where you | |
77 | want to abort with a `400 BAD REQUEST` instead of silently ignoring the error. | |
74 | Functions that do internal encoding or decoding accept an ``errors`` | |
75 | keyword argument that is passed to :meth:`str.decode` and | |
76 | :meth:`str.encode`. The default is ``'replace'`` so that errors are easy | |
77 | to spot. It might be useful to set it to ``'strict'`` in order to catch | |
78 | the error and report the bad data to the client. | |
78 | 79 | |
79 | All the functions that do internal decoding now accept an `errors` keyword | |
80 | argument that behaves like the `errors` parameter of the builtin string method | |
81 | `decode`. The following values are possible: | |
82 | ||
83 | `ignore` | |
84 | This is the default behavior and tells the codec to ignore characters that | |
85 | it doesn't understand silently. | |
86 | ||
87 | `replace` | |
88 | The codec will replace unknown characters with a replacement character | |
89 | (`U+FFFD` ``REPLACEMENT CHARACTER``) | |
90 | ||
91 | `strict` | |
92 | Raise an exception if decoding fails. | |
93 | ||
94 | Unlike the regular python decoding Werkzeug does not raise an | |
95 | :exc:`UnicodeDecodeError` if the decoding failed but an | |
96 | :exc:`~exceptions.HTTPUnicodeError` which | |
97 | is a direct subclass of `UnicodeError` and the `BadRequest` HTTP exception. | |
98 | The reason is that if this exception is not caught by the application but | |
99 | a catch-all for HTTP exceptions exists a default `400 BAD REQUEST` error | |
100 | page is displayed. | |
101 | ||
102 | There is additional error handling available which is a Werkzeug extension | |
103 | to the regular codec error handling which is called `fallback`. Often you | |
104 | want to use utf-8 but support latin1 as legacy encoding too if decoding | |
105 | failed. For this case you can use the `fallback` error handling. For | |
106 | example you can specify ``'fallback:iso-8859-15'`` to tell Werkzeug it should | |
107 | try with `iso-8859-15` if `utf-8` failed. If this decoding fails too (which | |
108 | should not happen for most legacy charsets such as `iso-8859-15`) the error | |
109 | is silently ignored as if the error handling was `ignore`. | |
110 | ||
111 | Further details are available as part of the API documentation of the concrete | |
112 | implementations of the functions or classes working with unicode. | |
113 | 80 | |
114 | 81 | Request and Response Objects |
115 | 82 | ============================ |
0 | 0 | [metadata] |
1 | 1 | license_file = LICENSE.rst |
2 | long_description_content_type = text/x-rst | |
2 | 3 | |
3 | 4 | [bdist_wheel] |
4 | 5 | universal = true |
7 | 8 | testpaths = tests |
8 | 9 | norecursedirs = tests/hypothesis |
9 | 10 | filterwarnings = |
11 | error | |
10 | 12 | ignore::requests.packages.urllib3.exceptions.InsecureRequestWarning |
11 | 13 | ; warning about collections.abc fixed in watchdog master |
12 | 14 | ignore::DeprecationWarning:watchdog.utils.bricks:175 |
51 | 53 | **/__init__.py: F401 |
52 | 54 | # LocalProxy assigns lambdas |
53 | 55 | src/werkzeug/local.py: E731 |
56 | src/werkzeug/contrib/*.py: B014 |
39 | 39 | "Programming Language :: Python :: 3.5", |
40 | 40 | "Programming Language :: Python :: 3.6", |
41 | 41 | "Programming Language :: Python :: 3.7", |
42 | "Programming Language :: Python :: 3.8", | |
42 | 43 | "Programming Language :: Python :: Implementation :: CPython", |
43 | 44 | "Programming Language :: Python :: Implementation :: PyPy", |
44 | 45 | "Topic :: Internet :: WWW/HTTP :: Dynamic Content", |
13 | 13 | """ |
14 | 14 | from types import ModuleType |
15 | 15 | |
16 | __version__ = "0.16.0" | |
16 | __version__ = "0.16.1" | |
17 | 17 | |
18 | 18 | __all__ = ["run_simple", "Client", "Request", "Response", "__version__"] |
19 | 19 | |
52 | 52 | |
53 | 53 | # Import the module, get the attribute, and show a warning about where |
54 | 54 | # to correctly import it from. |
55 | mod = import_module(origin, self.__name__.rsplit(".")[0]) | |
55 | package = self.__name__.rsplit(".")[0] | |
56 | mod = import_module(origin, package) | |
56 | 57 | value = getattr(mod, item) |
57 | 58 | warn( |
58 | 59 | "The import '{name}.{item}' is deprecated and will be removed in" |
59 | " {removed_in}. Use 'from {name}{origin} import {item}'" | |
60 | " {removed_in}. Use 'from {package}{origin} import {item}'" | |
60 | 61 | " instead.".format( |
61 | 62 | name=self.__name__, |
62 | 63 | item=item, |
63 | 64 | removed_in=self._removed_in, |
65 | package=package, | |
64 | 66 | origin=origin, |
65 | 67 | ), |
66 | 68 | DeprecationWarning, |
272 | 272 | self.end_headers() |
273 | 273 | |
274 | 274 | assert isinstance(data, bytes), "applications must write bytes" |
275 | self.wfile.write(data) | |
275 | if data: | |
276 | # Only write data if there is any to avoid Python 3.5 SSL bug | |
277 | self.wfile.write(data) | |
276 | 278 | self.wfile.flush() |
277 | 279 | |
278 | 280 | def start_response(status, response_headers, exc_info=None): |
294 | 294 | raise RuntimeError("Change event not detected.") |
295 | 295 | |
296 | 296 | |
297 | def test_windows_get_args_for_reloading(monkeypatch, tmpdir): | |
298 | test_py_exe = r"C:\Users\test\AppData\Local\Programs\Python\Python36\python.exe" | |
299 | monkeypatch.setattr(os, "name", "nt") | |
300 | monkeypatch.setattr(sys, "executable", test_py_exe) | |
301 | test_exe = tmpdir.mkdir("test").join("test.exe") | |
302 | monkeypatch.setattr(sys, "argv", [test_exe.strpath, "run"]) | |
297 | def test_windows_get_args_for_reloading(monkeypatch, tmp_path): | |
298 | argv = [str(tmp_path / "test.exe"), "run"] | |
299 | monkeypatch.setattr("sys.executable", str(tmp_path / "python.exe")) | |
300 | monkeypatch.setattr("sys.argv", argv) | |
301 | monkeypatch.setattr("__main__.__package__", None) | |
302 | monkeypatch.setattr("os.name", "nt") | |
303 | 303 | rv = _reloader._get_args_for_reloading() |
304 | assert rv == [test_exe.strpath, "run"] | |
304 | assert rv == argv | |
305 | 305 | |
306 | 306 | |
307 | 307 | def test_monkeypatched_sleep(tmpdir): |
0 | 0 | [tox] |
1 | 1 | envlist = |
2 | py{37,36,35,27,py3,py} | |
2 | py{38,37,36,35,27,py3,py} | |
3 | 3 | style |
4 | docs-html | |
4 | docs | |
5 | 5 | coverage |
6 | 6 | skip_missing_interpreters = true |
7 | 7 | |
23 | 23 | skip_install = true |
24 | 24 | commands = pre-commit run --all-files --show-diff-on-failure |
25 | 25 | |
26 | [testenv:docs-html] | |
27 | deps = | |
28 | Sphinx | |
29 | Pallets-Sphinx-Themes | |
30 | sphinx-issues | |
26 | [testenv:docs] | |
27 | deps = -r docs/requirements.txt | |
31 | 28 | commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html |
32 | 29 | |
33 | 30 | [testenv:coverage] |
44 | 41 | commands = |
45 | 42 | coverage combine |
46 | 43 | coverage xml |
47 | coverage report |