Codebase list python-werkzeug / 9bb344a
Imported Debian patch 0.9.1+dfsg-1 Piotr Ożarowski 10 years ago
18 changed file(s) with 88 addition(s) and 36 deletion(s). Raw diff Collapse all Expand all
00 Werkzeug Changelog
11 ==================
2
3 Version 0.9.1
4 -------------
5
6 (bugfix release, released on June 14th 2013)
7
8 - Fixed an issue with integers no longer being accepted in certain
9 parts of the routing system or URL quoting functions.
10 - Fixed an issue with `url_quote` not producing the right escape
11 codes for single digit codepoints.
12 - Fixed an issue with :class:`~werkzeug.wsgi.SharedDataMiddleware` not
13 reading the path correctly and breaking on etag generation in some
14 cases.
15 - Properly handle `Expect: 100-continue` in the development server
16 to resolve issues with curl.
17 - Automatically exhaust the input stream on request close. This should
18 fix issues where not touching request files results in a timeout.
19 - Fixed exhausting of streams not doing anything if a non-limited
20 stream was passed into the multipart parser.
21 - Raised the buffer sizes for the multipart parser.
222
323 Version 0.9
424 -----------
00 Metadata-Version: 1.0
11 Name: Werkzeug
2 Version: 0.9
2 Version: 0.9.1
33 Summary: The Swiss Army knife of Python web development
44 Home-page: http://werkzeug.pocoo.org/
55 Author: Armin Ronacher
+0
-19
README.rst less more
0 Werkzeug
1 ========
2
3 Werkzeug started as simple collection of various utilities for WSGI
4 applications and has become one of the most advanced WSGI utility
5 modules. It includes a powerful debugger, full-featured request and
6 response objects, HTTP utilities to handle entity tags, cache control
7 headers, HTTP dates, cookie handling, file uploads, a powerful URL
8 routing system and a bunch of community-contributed addon modules.
9
10 Werkzeug is unicode aware and doesn't enforce a specific template
11 engine, database adapter or anything else. It doesn't even enforce
12 a specific way of handling requests and leaves all that up to the
13 developer. It's most useful for end user applications which should work
14 on as many server environments as possible (such as blogs, wikis,
15 bulletin boards, etc.).
16
17 Details and example applications are available on the
18 `Werkzeug website <http://werkzeug.pocoo.org/>`_.
00 Metadata-Version: 1.0
11 Name: Werkzeug
2 Version: 0.9
2 Version: 0.9.1
33 Summary: The Swiss Army knife of Python web development
44 Home-page: http://werkzeug.pocoo.org/
55 Author: Armin Ronacher
22 LICENSE
33 MANIFEST.in
44 Makefile
5 README.rst
65 setup.cfg
76 setup.py
87 Werkzeug.egg-info/PKG-INFO
0 python-werkzeug (0.9.1+dfsg-1) unstable; urgency=low
1
2 * New upstream release
3 * Run tests with LC_ALL=C.UTF-8
4
5 -- Piotr Ożarowski <piotr@debian.org> Sun, 16 Jun 2013 11:51:23 +0200
6
07 python-werkzeug (0.9+dfsg-1) unstable; urgency=low
18
29 [ Piotr Ożarowski ]
3131 # run-tests.py is not included in the tarball
3232 # TODO: run tests for all supported Python versions
3333 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
34 python -c 'from werkzeug.testsuite import main; main()'
34 LC_ALL=C.UTF-8 python -c 'from werkzeug.testsuite import main; main()'
3535 endif
3636
3737 clean:
6060
6161 setup(
6262 name='Werkzeug',
63 version='0.9',
63 version='0.9.1',
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'
22 __version__ = '0.9.1'
2323
2424
2525 # This import magic raises concerns quite often which is why the implementation
100100 exhaust = getattr(stream, 'exhaust', None)
101101 if exhaust is not None:
102102 exhaust()
103 else:
104 while 1:
105 chunk = stream.read(1024 * 64)
106 if not chunk:
107 break
103108 return update_wrapper(wrapper, f)
104109
105110
275280 class MultiPartParser(object):
276281
277282 def __init__(self, stream_factory=None, charset='utf-8', errors='replace',
278 max_form_memory_size=None, cls=None, buffer_size=10 * 1024):
283 max_form_memory_size=None, cls=None, buffer_size=64 * 1024):
279284 self.stream_factory = stream_factory
280285 self.charset = charset
281286 self.errors = errors
838838 return value
839839
840840 def to_url(self, value):
841 return url_quote(to_bytes(value, self.map.charset))
841 return url_quote(value, charset=self.map.charset)
842842
843843
844844 class UnicodeConverter(BaseConverter):
114114 return environ
115115
116116 def run_wsgi(self):
117 if self.headers.get('Expect', '').lower().strip() == '100-continue':
118 self.wfile.write(b'HTTP/1.1 100 Continue\r\n\r\n')
119
117120 environ = self.make_environ()
118121 headers_set = []
119122 headers_sent = []
1313 import re
1414 import sys
1515 import unittest
16 import shutil
17 import tempfile
18 import atexit
1619
1720 from werkzeug.utils import find_modules
1821 from werkzeug._compat import text_type, integer_types, reraise
22
23
24 def get_temporary_directory():
25 directory = tempfile.mkdtemp()
26 @atexit.register
27 def remove_directory():
28 try:
29 shutil.rmtree(directory)
30 except EnvironmentError:
31 pass
32 return directory
1933
2034
2135 def iter_suites(package):
358358 ('/test4-meh', '', 'test4baz')
359359 ])
360360
361 def test_non_string_parts(self):
362 m = r.Map([
363 r.Rule('/<foo>', endpoint='foo')
364 ])
365 a = m.bind('example.com')
366 self.assert_equal(a.build('foo', {'foo': 42}), '/42')
367
361368 def test_complex_routing_rules(self):
362369 m = r.Map([
363370 r.Rule('/', endpoint='index'),
3434 self.assert_strict_equal(urls.url_encode({u'a': None, u'b': u'foo bar'}), 'b=foo+bar')
3535 self.assert_strict_equal(urls.url_fix(u'http://de.wikipedia.org/wiki/Elf (Begriffsklärung)'),
3636 'http://de.wikipedia.org/wiki/Elf%20(Begriffskl%C3%A4rung)')
37 self.assert_strict_equal(urls.url_quote_plus(42), '42')
38 self.assert_strict_equal(urls.url_quote(b'\xff'), '%FF')
3739
3840 def test_bytes_unquoting(self):
3941 self.assert_strict_equal(urls.url_unquote(urls.url_quote(
1111 from os import path
1212 from contextlib import closing
1313
14 from werkzeug.testsuite import WerkzeugTestCase
14 from werkzeug.testsuite import WerkzeugTestCase, get_temporary_directory
1515
1616 from werkzeug.wrappers import BaseResponse
1717 from werkzeug.exceptions import BadRequest, ClientDisconnected
1818 from werkzeug.test import Client, create_environ, run_wsgi_app
1919 from werkzeug import wsgi
20 from werkzeug._compat import StringIO, BytesIO, NativeStringIO
20 from werkzeug._compat import StringIO, BytesIO, NativeStringIO, to_native
2121
2222
2323 class WSGIUtilsTestCase(WerkzeugTestCase):
3030 def null_application(environ, start_response):
3131 start_response('404 NOT FOUND', [('Content-Type', 'text/plain')])
3232 yield b'NOT FOUND'
33
34 test_dir = get_temporary_directory()
35 with open(path.join(test_dir, to_native(u'äöü', 'utf-8')), 'w') as test_file:
36 test_file.write(u'FOUND')
37
3338 app = wsgi.SharedDataMiddleware(null_application, {
3439 '/': path.join(path.dirname(__file__), 'res'),
3540 '/sources': path.join(path.dirname(__file__), 'res'),
36 '/pkg': ('werkzeug.debug', 'shared')
41 '/pkg': ('werkzeug.debug', 'shared'),
42 '/foo': test_dir
3743 })
3844
39 for p in '/test.txt', '/sources/test.txt':
45 for p in '/test.txt', '/sources/test.txt', '/foo/äöü':
4046 app_iter, status, headers = run_wsgi_app(app, create_environ(p))
4147 self.assert_equal(status, '200 OK')
4248 with closing(app_iter) as app_iter:
5359 app, create_environ('/missing'))
5460 self.assert_equal(status, '404 NOT FOUND')
5561 self.assert_equal(b''.join(app_iter).strip(), b'NOT FOUND')
62
5663
5764 def test_get_host(self):
5865 env = {'HTTP_X_FORWARDED_HOST': 'example.org',
377377 :param charset: the charset to be used.
378378 :param safe: an optional sequence of safe characters.
379379 """
380 if not isinstance(string, (text_type, bytes, bytearray)):
381 string = text_type(string)
380382 if isinstance(string, text_type):
381383 string = string.encode(charset, errors)
382384 if isinstance(safe, text_type):
387389 if char in safe:
388390 rv.append(char)
389391 else:
390 rv.extend(('%%%X' % char).encode('ascii'))
392 rv.extend(('%%%02X' % char).encode('ascii'))
391393 return to_native(bytes(rv))
392394
393395
2020
2121 from werkzeug._compat import iteritems, text_type, string_types, \
2222 implements_iterator, make_literal_wrapper, to_unicode, to_bytes, \
23 wsgi_get_bytes, try_coerce_native
23 wsgi_get_bytes, try_coerce_native, PY2
2424 from werkzeug._internal import _empty_stream, _encode_idna
2525 from werkzeug.http import is_resource_modified, http_date
2626 from werkzeug.urls import uri_to_iri, url_quote, url_parse, url_join
543543 return loader
544544
545545 def generate_etag(self, mtime, file_size, real_filename):
546 if not isinstance(real_filename, bytes):
547 real_filename = real_filename.encode(sys.getfilesystemencoding())
546548 return 'wzsdm-%d-%s-%s' % (
547549 mktime(mtime.timetuple()),
548550 file_size,
549 adler32(real_filename.encode(sys.getfilesystemencoding())) & 0xffffffff
551 adler32(real_filename) & 0xffffffff
550552 )
551553
552554 def __call__(self, environ, start_response):
555 cleaned_path = get_path_info(environ)
556 if PY2:
557 cleaned_path = cleaned_path.encode(sys.getfilesystemencoding())
553558 # sanitize the path for non unix systems
554 cleaned_path = environ.get('PATH_INFO', '').strip('/')
559 cleaned_path = cleaned_path.strip('/')
555560 for sep in os.sep, os.altsep:
556561 if sep and sep != '/':
557562 cleaned_path = cleaned_path.replace(sep, '/')
945950 from werkzeug.exceptions import ClientDisconnected
946951 raise ClientDisconnected()
947952
948 def exhaust(self, chunk_size=1024 * 16):
953 def exhaust(self, chunk_size=1024 * 64):
949954 """Exhaust the stream. This consumes all the data left until the
950955 limit is reached.
951956