Imported Upstream version 0.9.4+dfsg
SVN-Git Migration
8 years ago
0 | 0 |
Werkzeug Changelog
|
1 | 1 |
==================
|
|
2 |
|
|
3 |
Version 0.9.4
|
|
4 |
-------------
|
|
5 |
|
|
6 |
(bugfix release, released on August 26th 2013)
|
|
7 |
|
|
8 |
- Fixed an issue with Python 3.3 and an edge case in cookie parsing.
|
|
9 |
- Fixed decoding errors not handled properly through the WSGI
|
|
10 |
decoding dance.
|
|
11 |
- Fixed URI to IRI conversion incorrectly decoding percent signs.
|
2 | 12 |
|
3 | 13 |
Version 0.9.3
|
4 | 14 |
-------------
|
0 | 0 |
Metadata-Version: 1.0
|
1 | 1 |
Name: Werkzeug
|
2 | |
Version: 0.9.3
|
|
2 |
Version: 0.9.4
|
3 | 3 |
Summary: The Swiss Army knife of Python web development
|
4 | 4 |
Home-page: http://werkzeug.pocoo.org/
|
5 | 5 |
Author: Armin Ronacher
|
0 | 0 |
Metadata-Version: 1.0
|
1 | 1 |
Name: Werkzeug
|
2 | |
Version: 0.9.3
|
|
2 |
Version: 0.9.4
|
3 | 3 |
Summary: The Swiss Army knife of Python web development
|
4 | 4 |
Home-page: http://werkzeug.pocoo.org/
|
5 | 5 |
Author: Armin Ronacher
|
22 | 22 |
|
23 | 23 |
|
24 | 24 |
def application(environ, start_response):
|
|
25 |
session = environ['werkzeug.session']
|
|
26 |
session['visit_count'] = session.get('visit_count', 0) + 1
|
|
27 |
|
25 | 28 |
start_response('200 OK', [('Content-Type', 'text/html')])
|
26 | |
session = environ['werkzeug.session']
|
27 | |
yield '<title>Session Example</title><h1>Session Example</h1>'
|
28 | |
if session.new:
|
29 | |
session['visit_count'] = 0
|
30 | |
yield '<p>This is a new session.</p>'
|
31 | |
session['visit_count'] += 1
|
32 | |
yield '<p>You visited this page %d times.</p>' % session['visit_count']
|
|
29 |
return ['''
|
|
30 |
<!doctype html>
|
|
31 |
<title>Session Example</title>
|
|
32 |
<h1>Session Example</h1>
|
|
33 |
<p>You visited this page %d times.</p>
|
|
34 |
''' % session['visit_count']]
|
33 | 35 |
|
34 | 36 |
|
35 | 37 |
def make_app():
|
60 | 60 |
|
61 | 61 |
setup(
|
62 | 62 |
name='Werkzeug',
|
63 | |
version='0.9.3',
|
|
63 |
version='0.9.4',
|
64 | 64 |
url='http://werkzeug.pocoo.org/',
|
65 | 65 |
license='BSD',
|
66 | 66 |
author='Armin Ronacher',
|
19 | 19 |
from werkzeug._compat import iteritems
|
20 | 20 |
|
21 | 21 |
# the version. Usually set automatically by a script.
|
22 | |
__version__ = '0.9.3'
|
|
22 |
__version__ = '0.9.4'
|
23 | 23 |
|
24 | 24 |
|
25 | 25 |
# This import magic raises concerns quite often which is why the implementation
|
88 | 88 |
wsgi_get_bytes = _identity
|
89 | 89 |
|
90 | 90 |
def wsgi_decoding_dance(s, charset='utf-8', errors='replace'):
|
91 | |
return s.decode(charset)
|
|
91 |
return s.decode(charset, errors)
|
92 | 92 |
|
93 | 93 |
def wsgi_encoding_dance(s, charset='utf-8', errors='replace'):
|
94 | 94 |
if isinstance(s, bytes):
|
95 | 95 |
return s
|
96 | |
return s.encode(charset)
|
|
96 |
return s.encode(charset, errors)
|
97 | 97 |
|
98 | 98 |
def to_bytes(x, charset=sys.getdefaultencoding(), errors='strict'):
|
99 | 99 |
if x is None:
|
282 | 282 |
def test_cookies(self):
|
283 | 283 |
self.assert_strict_equal(
|
284 | 284 |
dict(http.parse_cookie('dismiss-top=6; CP=null*; PHPSESSID=0a539d42abc001cd'
|
285 | |
'c762809248d4beed; a=42')),
|
|
285 |
'c762809248d4beed; a=42; b="\\\";"')),
|
286 | 286 |
{
|
287 | 287 |
'CP': u'null*',
|
288 | 288 |
'PHPSESSID': u'0a539d42abc001cdc762809248d4beed',
|
289 | 289 |
'a': u'42',
|
290 | |
'dismiss-top': u'6'
|
|
290 |
'dismiss-top': u'6',
|
|
291 |
'b': u'\";'
|
291 | 292 |
}
|
292 | 293 |
)
|
293 | 294 |
self.assert_strict_equal(
|
144 | 144 |
self.assert_strict_equal(urls.iri_to_uri(u'http://föö.com:8080/bam/baz'),
|
145 | 145 |
'http://xn--f-1gaa.com:8080/bam/baz')
|
146 | 146 |
|
|
147 |
def test_iri_safe_quoting(self):
|
|
148 |
uri = b'http://xn--f-1gaa.com/%2F%25?q=%C3%B6&x=%3D%25#%25'
|
|
149 |
iri = u'http://föö.com/%2F%25?q=ö&x=%3D%25#%25'
|
|
150 |
self.assert_strict_equal(urls.uri_to_iri(uri), iri)
|
|
151 |
self.assert_strict_equal(urls.iri_to_uri(urls.uri_to_iri(uri)), uri)
|
|
152 |
|
147 | 153 |
def test_ordered_multidict_encoding(self):
|
148 | 154 |
d = OrderedMultiDict()
|
149 | 155 |
d.add('foo', 1)
|
145 | 145 |
|
146 | 146 |
req = wrappers.Request.from_values('/bar?foo=baz', 'https://example.com/test')
|
147 | 147 |
self.assert_strict_equal(req.scheme, 'https')
|
|
148 |
|
|
149 |
def test_url_request_descriptors_query_quoting(self):
|
|
150 |
next = 'http%3A%2F%2Fwww.example.com%2F%3Fnext%3D%2F'
|
|
151 |
req = wrappers.Request.from_values('/bar?next=' + next, 'http://example.com/')
|
|
152 |
self.assert_equal(req.path, u'/bar')
|
|
153 |
self.assert_strict_equal(req.full_path, u'/bar?next=' + next)
|
|
154 |
self.assert_strict_equal(req.url, u'http://example.com/bar?next=' + next)
|
148 | 155 |
|
149 | 156 |
def test_url_request_descriptors_hosts(self):
|
150 | 157 |
req = wrappers.Request.from_values('/bar?foo=baz', 'http://example.com/test')
|
521 | 521 |
if isinstance(uri, tuple):
|
522 | 522 |
uri = url_unparse(uri)
|
523 | 523 |
uri = url_parse(to_unicode(uri, charset))
|
524 | |
path = url_unquote(uri.path, charset, errors, '/;?')
|
525 | |
query = url_unquote(uri.query, charset, errors, ';/?:@&=+,$')
|
526 | |
fragment = url_unquote(uri.fragment, charset, errors, ';/?:@&=+,$')
|
|
524 |
path = url_unquote(uri.path, charset, errors, '%/;?')
|
|
525 |
query = url_unquote(uri.query, charset, errors, '%;/?:@&=+,$')
|
|
526 |
fragment = url_unquote(uri.fragment, charset, errors, '%;/?:@&=+,$')
|
527 | 527 |
return url_unparse((uri.scheme, uri.decode_netloc(),
|
528 | 528 |
path, query, fragment))
|
529 | 529 |
|