Codebase list python-werkzeug / 7b1fc68
New upstream version 0.16.1+dfsg1 Ondřej Nový 4 years ago
10 changed file(s) with 58 addition(s) and 74 deletion(s). Raw diff Collapse all Expand all
33
44 variables:
55 vmImage: ubuntu-latest
6 python.version: 3.7
6 python.version: '3.8'
77 TOXENV: py,coverage-ci
8 hasTestResults: true
8 hasTestResults: 'true'
99
1010 strategy:
1111 matrix:
12 Python 3.7 Linux:
12 Python 3.8 Linux:
1313 vmImage: ubuntu-latest
14 Python 3.7 Windows:
14 Python 3.8 Windows:
1515 vmImage: windows-latest
16 Python 3.7 Mac:
16 Python 3.8 Mac:
1717 vmImage: macos-latest
1818 PyPy 3 Linux:
1919 python.version: pypy3
20 Python 3.7 Linux:
21 python.version: '3.7'
2022 Python 3.6 Linux:
21 python.version: 3.6
23 python.version: '3.6'
2224 Python 3.5 Linux:
23 python.version: 3.5
25 python.version: '3.5'
2426 Python 2.7 Linux:
25 python.version: 2.7
27 python.version: '2.7'
2628 Python 2.7 Windows:
27 python.version: 2.7
29 python.version: '2.7'
2830 vmImage: windows-latest
2931 Docs:
30 TOXENV: docs-html
31 hasTestResults: false
32 TOXENV: docs
33 hasTestResults: 'false'
3234 Style:
3335 TOXENV: style
34 hasTestResults: false
36 hasTestResults: 'false'
3537
3638 pool:
3739 vmImage: $[ variables.vmImage ]
00 repos:
11 - repo: https://github.com/asottile/reorder_python_imports
2 rev: v1.4.0
2 rev: v1.8.0
33 hooks:
44 - id: reorder-python-imports
55 name: Reorder Python imports (src, tests)
1010 files: "^examples/"
1111 args: ["--application-directories", "examples"]
1212 - repo: https://github.com/ambv/black
13 rev: 18.9b0
13 rev: 19.10b0
1414 hooks:
1515 - id: black
1616 - repo: https://gitlab.com/pycqa/flake8
17 rev: 3.7.7
17 rev: 3.7.9
1818 hooks:
1919 - id: flake8
2020 additional_dependencies: [flake8-bugbear]
2121 - repo: https://github.com/pre-commit/pre-commit-hooks
22 rev: v2.1.0
22 rev: v2.4.0
2323 hooks:
2424 - id: check-byte-order-marker
2525 - id: trailing-whitespace
00 .. 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
112
213 Version 0.16.0
314 --------------
6767 There is also the codecs module which provides an open function that decodes
6868 automatically from the given encoding.
6969
70
7071 Error Handling
7172 ==============
7273
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.
7879
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.
11380
11481 Request and Response Objects
11582 ============================
00 [metadata]
11 license_file = LICENSE.rst
2 long_description_content_type = text/x-rst
23
34 [bdist_wheel]
45 universal = true
78 testpaths = tests
89 norecursedirs = tests/hypothesis
910 filterwarnings =
11 error
1012 ignore::requests.packages.urllib3.exceptions.InsecureRequestWarning
1113 ; warning about collections.abc fixed in watchdog master
1214 ignore::DeprecationWarning:watchdog.utils.bricks:175
5153 **/__init__.py: F401
5254 # LocalProxy assigns lambdas
5355 src/werkzeug/local.py: E731
56 src/werkzeug/contrib/*.py: B014
3939 "Programming Language :: Python :: 3.5",
4040 "Programming Language :: Python :: 3.6",
4141 "Programming Language :: Python :: 3.7",
42 "Programming Language :: Python :: 3.8",
4243 "Programming Language :: Python :: Implementation :: CPython",
4344 "Programming Language :: Python :: Implementation :: PyPy",
4445 "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
1313 """
1414 from types import ModuleType
1515
16 __version__ = "0.16.0"
16 __version__ = "0.16.1"
1717
1818 __all__ = ["run_simple", "Client", "Request", "Response", "__version__"]
1919
5252
5353 # Import the module, get the attribute, and show a warning about where
5454 # 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)
5657 value = getattr(mod, item)
5758 warn(
5859 "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}'"
6061 " instead.".format(
6162 name=self.__name__,
6263 item=item,
6364 removed_in=self._removed_in,
65 package=package,
6466 origin=origin,
6567 ),
6668 DeprecationWarning,
272272 self.end_headers()
273273
274274 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)
276278 self.wfile.flush()
277279
278280 def start_response(status, response_headers, exc_info=None):
294294 raise RuntimeError("Change event not detected.")
295295
296296
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")
303303 rv = _reloader._get_args_for_reloading()
304 assert rv == [test_exe.strpath, "run"]
304 assert rv == argv
305305
306306
307307 def test_monkeypatched_sleep(tmpdir):
00 [tox]
11 envlist =
2 py{37,36,35,27,py3,py}
2 py{38,37,36,35,27,py3,py}
33 style
4 docs-html
4 docs
55 coverage
66 skip_missing_interpreters = true
77
2323 skip_install = true
2424 commands = pre-commit run --all-files --show-diff-on-failure
2525
26 [testenv:docs-html]
27 deps =
28 Sphinx
29 Pallets-Sphinx-Themes
30 sphinx-issues
26 [testenv:docs]
27 deps = -r docs/requirements.txt
3128 commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html
3229
3330 [testenv:coverage]
4441 commands =
4542 coverage combine
4643 coverage xml
47 coverage report