diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-04-21 16:37:43 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-04-21 16:37:43 +0200 |
commit | 2bf1efd8a56f5b487429c3f9e705071a3f7cf9e1 (patch) | |
tree | d6485069f2180410e78400ad16afc5e39084e144 | |
parent | 0c5b1445cb75e87e74ecc2eb513f1dad03a32cbf (diff) | |
download | paste-git-2bf1efd8a56f5b487429c3f9e705071a3f7cf9e1.tar.gz |
Port recursive to Python 3
HTTP body is bytes
-rw-r--r-- | paste/recursive.py | 8 | ||||
-rw-r--r-- | tests/test_recursive.py | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/paste/recursive.py b/paste/recursive.py index 8f28fc3..0bef920 100644 --- a/paste/recursive.py +++ b/paste/recursive.py @@ -115,10 +115,10 @@ class ForwardRequestException(Exception): def app(environ, start_response): if environ['PATH_INFO'] == '/hello': start_response("200 OK", [('Content-type', 'text/plain')]) - return ['Hello World!'] + return [b'Hello World!'] elif environ['PATH_INFO'] == '/error': start_response("404 Not Found", [('Content-type', 'text/plain')]) - return ['Page not found'] + return [b'Page not found'] else: raise ForwardRequestException('/error') @@ -158,10 +158,10 @@ class ForwardRequestException(Exception): def app(environ, start_response): if environ['PATH_INFO'] == '/hello': start_response("200 OK", [('Content-type', 'text/plain')]) - return ['Hello World!'] + return [b'Hello World!'] elif environ['PATH_INFO'] == '/error': start_response("404 Not Found", [('Content-type', 'text/plain')]) - return ['Page not found'] + return [b'Page not found'] else: def factory(app): return StatusKeeper(app, status='404 Not Found', url='/error') diff --git a/tests/test_recursive.py b/tests/test_recursive.py index 8d2f96b..7664382 100644 --- a/tests/test_recursive.py +++ b/tests/test_recursive.py @@ -5,10 +5,10 @@ from paste.recursive import RecursiveMiddleware, ForwardRequestException def error_docs_app(environ, start_response): if environ['PATH_INFO'] == '/not_found': start_response("404 Not found", [('Content-type', 'text/plain')]) - return ['Not found'] + return [b'Not found'] elif environ['PATH_INFO'] == '/error': start_response("200 OK", [('Content-type', 'text/plain')]) - return ['Page not found'] + return [b'Page not found'] elif environ['PATH_INFO'] == '/recurse': raise ForwardRequestException('/recurse') else: |