Import python-werkzeug_0.11.11+dfsg1.orig.tar.gz
Ondřej Nový
7 years ago
16 | 16 |
PYENV_ROOT="$HOME/.pyenv";
|
17 | 17 |
PATH="$PYENV_ROOT/bin:$PATH";
|
18 | 18 |
eval "$(pyenv init -)";
|
19 | |
pyenv install pypy-2.6.1;
|
20 | |
pyenv global pypy-2.6.1;
|
|
19 |
pyenv install pypy-4.0.1;
|
|
20 |
pyenv global pypy-4.0.1;
|
21 | 21 |
fi
|
22 | 22 |
- python --version
|
23 | 23 |
- pip install tox flake8
|
24 | 24 |
|
25 | 25 |
script:
|
26 | 26 |
- tox -e py
|
27 | |
- make stylecheck
|
|
27 |
- '[ "$TRAVIS_PYTHON_VERSION" = "2.6" ] || make stylecheck'
|
28 | 28 |
|
29 | 29 |
branches:
|
30 | 30 |
except:
|
27 | 27 |
- Daniel Neuhäuser
|
28 | 28 |
- Markus Unterwaditzer
|
29 | 29 |
- Joe Esposito <joe@joeyespo.com>
|
|
30 |
- Cédric Krier
|
|
31 |
- Lars Holm Nielsen
|
30 | 32 |
|
31 | 33 |
Contributors of code for werkzeug/examples are:
|
32 | 34 |
|
0 | 0 |
Werkzeug Changelog
|
1 | 1 |
==================
|
|
2 |
|
|
3 |
Version 0.11.11
|
|
4 |
---------------
|
|
5 |
|
|
6 |
Released on August 31st 2016.
|
|
7 |
|
|
8 |
- Fix JSONRequestMixin for Python3. See #731
|
|
9 |
- Fix broken string handling in test client when passing integers. See #852
|
|
10 |
- Fix a bug in ``parse_options_header`` where an invalid content type
|
|
11 |
starting with comma or semi-colon would result in an invalid return value,
|
|
12 |
see issue ``#995``.
|
|
13 |
- Fix a bug in multidicts when passing empty lists as values, see issue
|
|
14 |
``#979``.
|
|
15 |
- Fix a security issue that allows XSS on the Werkzeug debugger. See ``#1001``.
|
2 | 16 |
|
3 | 17 |
Version 0.11.10
|
4 | 18 |
---------------
|
|
276 | 290 |
object (pull request ``#583``).
|
277 | 291 |
- The ``qop`` parameter for ``WWW-Authenticate`` headers is now always quoted,
|
278 | 292 |
as required by RFC 2617 (issue ``#633``).
|
279 | |
- Fix bug in ``werkzeug.contrib.cache.SimpleCache`` with Python 3 where add/set
|
|
293 |
- Fix bug in ``werkzeug.contrib.cache.SimpleCache`` with Python 3 where add/set
|
280 | 294 |
may throw an exception when pruning old entries from the cache (pull request
|
281 | 295 |
``#651``).
|
282 | 296 |
|
13 | 13 |
from werkzeug.contrib import wrappers
|
14 | 14 |
from werkzeug import routing
|
15 | 15 |
from werkzeug.wrappers import Request, Response
|
|
16 |
|
|
17 |
|
|
18 |
def test_json_request_mixin():
|
|
19 |
class MyRequest(wrappers.JSONRequestMixin, Request):
|
|
20 |
pass
|
|
21 |
req = MyRequest.from_values(
|
|
22 |
data=u'{"foä": "bar"}'.encode('utf-8'),
|
|
23 |
content_type='text/json'
|
|
24 |
)
|
|
25 |
assert req.json == {u'foä': 'bar'}
|
16 | 26 |
|
17 | 27 |
|
18 | 28 |
def test_reverse_slash_behavior():
|
375 | 375 |
assert list(zip(md, iterlistvalues(md))) == list(iterlists(md))
|
376 | 376 |
assert list(zip(iterkeys(md), iterlistvalues(md))) == \
|
377 | 377 |
list(iterlists(md))
|
|
378 |
|
|
379 |
def test_getitem_raise_badrequestkeyerror_for_empty_list_value(self):
|
|
380 |
mapping = [('a', 'b'), ('a', 'c')]
|
|
381 |
md = self.storage_class(mapping)
|
|
382 |
|
|
383 |
md.setlistdefault('empty', [])
|
|
384 |
|
|
385 |
with pytest.raises(KeyError):
|
|
386 |
md['empty']
|
378 | 387 |
|
379 | 388 |
|
380 | 389 |
class TestOrderedMultiDict(_MutableMultiDictTests):
|
265 | 265 |
'text/x-dvi; q=0.8, text/x-c') == \
|
266 | 266 |
('text/plain', {'q': '0.5'})
|
267 | 267 |
|
|
268 |
def test_parse_options_header_broken_values(self):
|
|
269 |
# Issue #995
|
|
270 |
assert http.parse_options_header(' ') == ('', {})
|
|
271 |
assert http.parse_options_header(' , ') == ('', {})
|
|
272 |
assert http.parse_options_header(' ; ') == ('', {})
|
|
273 |
assert http.parse_options_header(' ,; ') == ('', {})
|
|
274 |
assert http.parse_options_header(' , a ') == ('', {})
|
|
275 |
assert http.parse_options_header(' ; a ') == ('', {})
|
|
276 |
|
268 | 277 |
def test_dump_options_header(self):
|
269 | 278 |
assert http.dump_options_header('foo', {'bar': 42}) == \
|
270 | 279 |
'foo; bar=42'
|
142 | 142 |
assert b.content_type == 'application/x-www-form-urlencoded'
|
143 | 143 |
b.files.add_file('test', BytesIO(b'test contents'), 'test.txt')
|
144 | 144 |
assert b.files['test'].content_type == 'text/plain'
|
|
145 |
b.form['test_int'] = 1
|
145 | 146 |
assert b.content_type == 'multipart/form-data'
|
146 | 147 |
|
147 | 148 |
req = b.get_request()
|
638 | 638 |
|
639 | 639 |
|
640 | 640 |
def test_form_parsing_failed():
|
641 | |
data = (
|
642 | |
b'--blah\r\n'
|
643 | |
)
|
644 | |
data = wrappers.Request.from_values(
|
|
641 |
data = b'--blah\r\n'
|
|
642 |
request = wrappers.Request.from_values(
|
645 | 643 |
input_stream=BytesIO(data),
|
646 | 644 |
content_length=len(data),
|
647 | 645 |
content_type='multipart/form-data; boundary=foo',
|
648 | 646 |
method='POST'
|
649 | 647 |
)
|
650 | |
assert not data.files
|
651 | |
assert not data.form
|
|
648 |
assert not request.files
|
|
649 |
assert not request.form
|
|
650 |
|
|
651 |
# Bad Content-Type
|
|
652 |
data = b'test'
|
|
653 |
request = wrappers.Request.from_values(
|
|
654 |
input_stream=BytesIO(data),
|
|
655 |
content_length=len(data),
|
|
656 |
content_type=', ',
|
|
657 |
method='POST'
|
|
658 |
)
|
|
659 |
assert not request.form
|
652 | 660 |
|
653 | 661 |
|
654 | 662 |
def test_file_closing():
|
19 | 19 |
from werkzeug._compat import iteritems
|
20 | 20 |
|
21 | 21 |
# the version. Usually set automatically by a script.
|
22 | |
__version__ = '0.11.10'
|
|
22 |
__version__ = '0.11.11-dev'
|
23 | 23 |
|
24 | 24 |
|
25 | 25 |
# This import magic raises concerns quite often which is why the implementation
|
55 | 55 |
if 'json' not in self.environ.get('CONTENT_TYPE', ''):
|
56 | 56 |
raise BadRequest('Not a JSON request')
|
57 | 57 |
try:
|
58 | |
return loads(self.data)
|
|
58 |
return loads(self.data.decode(self.charset, self.encoding_errors))
|
59 | 59 |
except Exception:
|
60 | 60 |
raise BadRequest('Unable to read JSON request')
|
61 | 61 |
|
371 | 371 |
tmp = {}
|
372 | 372 |
for key, value in iteritems(mapping):
|
373 | 373 |
if isinstance(value, (tuple, list)):
|
|
374 |
if len(value) == 0:
|
|
375 |
continue
|
374 | 376 |
value = list(value)
|
375 | 377 |
else:
|
376 | 378 |
value = [value]
|
|
397 | 399 |
:raise KeyError: if the key does not exist.
|
398 | 400 |
"""
|
399 | 401 |
if key in self:
|
400 | |
return dict.__getitem__(self, key)[0]
|
|
402 |
lst = dict.__getitem__(self, key)
|
|
403 |
if len(lst) > 0:
|
|
404 |
return lst[0]
|
401 | 405 |
raise exceptions.BadRequestKeyError(key)
|
402 | 406 |
|
403 | 407 |
def __setitem__(self, key, value):
|
357 | 357 |
'exception': exc,
|
358 | 358 |
'exception_type': escape(self.exception_type),
|
359 | 359 |
'summary': self.render_summary(include_title=False),
|
360 | |
'plaintext': self.plaintext,
|
|
360 |
'plaintext': escape(self.plaintext),
|
361 | 361 |
'plaintext_cs': re.sub('-{2,}', '-', self.plaintext),
|
362 | 362 |
'traceback_id': self.id,
|
363 | 363 |
'secret': secret
|
98 | 98 |
else:
|
99 | 99 |
if not isinstance(value, string_types):
|
100 | 100 |
value = str(value)
|
101 | |
else:
|
102 | |
value = to_bytes(value, charset)
|
|
101 |
|
|
102 |
value = to_bytes(value, charset)
|
103 | 103 |
write('\r\n\r\n')
|
104 | 104 |
write_binary(value)
|
105 | 105 |
write('\r\n')
|