Codebase list python-werkzeug / upstream/0.9.4+dfsg
Imported Upstream version 0.9.4+dfsg SVN-Git Migration 8 years ago
12 changed file(s) with 45 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
00 Werkzeug Changelog
11 ==================
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.
212
313 Version 0.9.3
414 -------------
00 Metadata-Version: 1.0
11 Name: Werkzeug
2 Version: 0.9.3
2 Version: 0.9.4
33 Summary: The Swiss Army knife of Python web development
44 Home-page: http://werkzeug.pocoo.org/
55 Author: Armin Ronacher
00 Metadata-Version: 1.0
11 Name: Werkzeug
2 Version: 0.9.3
2 Version: 0.9.4
33 Summary: The Swiss Army knife of Python web development
44 Home-page: http://werkzeug.pocoo.org/
55 Author: Armin Ronacher
2222
2323
2424 def application(environ, start_response):
25 session = environ['werkzeug.session']
26 session['visit_count'] = session.get('visit_count', 0) + 1
27
2528 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']]
3335
3436
3537 def make_app():
6060
6161 setup(
6262 name='Werkzeug',
63 version='0.9.3',
63 version='0.9.4',
6464 url='http://werkzeug.pocoo.org/',
6565 license='BSD',
6666 author='Armin Ronacher',
1919 from werkzeug._compat import iteritems
2020
2121 # the version. Usually set automatically by a script.
22 __version__ = '0.9.3'
22 __version__ = '0.9.4'
2323
2424
2525 # This import magic raises concerns quite often which is why the implementation
8888 wsgi_get_bytes = _identity
8989
9090 def wsgi_decoding_dance(s, charset='utf-8', errors='replace'):
91 return s.decode(charset)
91 return s.decode(charset, errors)
9292
9393 def wsgi_encoding_dance(s, charset='utf-8', errors='replace'):
9494 if isinstance(s, bytes):
9595 return s
96 return s.encode(charset)
96 return s.encode(charset, errors)
9797
9898 def to_bytes(x, charset=sys.getdefaultencoding(), errors='strict'):
9999 if x is None:
256256 k = q_match.start(0)
257257 if q_match and (not o_match or k < j):
258258 _push(b[i:k])
259 _push(b[k + 1])
259 _push(b[k + 1:k + 2])
260260 i = k + 2
261261 else:
262262 _push(b[i:j])
282282 def test_cookies(self):
283283 self.assert_strict_equal(
284284 dict(http.parse_cookie('dismiss-top=6; CP=null*; PHPSESSID=0a539d42abc001cd'
285 'c762809248d4beed; a=42')),
285 'c762809248d4beed; a=42; b="\\\";"')),
286286 {
287287 'CP': u'null*',
288288 'PHPSESSID': u'0a539d42abc001cdc762809248d4beed',
289289 'a': u'42',
290 'dismiss-top': u'6'
290 'dismiss-top': u'6',
291 'b': u'\";'
291292 }
292293 )
293294 self.assert_strict_equal(
144144 self.assert_strict_equal(urls.iri_to_uri(u'http://föö.com:8080/bam/baz'),
145145 'http://xn--f-1gaa.com:8080/bam/baz')
146146
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
147153 def test_ordered_multidict_encoding(self):
148154 d = OrderedMultiDict()
149155 d.add('foo', 1)
145145
146146 req = wrappers.Request.from_values('/bar?foo=baz', 'https://example.com/test')
147147 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)
148155
149156 def test_url_request_descriptors_hosts(self):
150157 req = wrappers.Request.from_values('/bar?foo=baz', 'http://example.com/test')
521521 if isinstance(uri, tuple):
522522 uri = url_unparse(uri)
523523 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, '%;/?:@&=+,$')
527527 return url_unparse((uri.scheme, uri.decode_netloc(),
528528 path, query, fragment))
529529