make sure all examples work on python 3

fix #1961
This commit is contained in:
Benoit Chesneau 2019-01-24 23:15:19 +01:00
parent 97a45805f8
commit fe7632fe37
4 changed files with 6 additions and 9 deletions

View File

@ -24,8 +24,7 @@ def app(environ, start_response):
response_headers = [ response_headers = [
('Content-type', 'text/plain'), ('Content-type', 'text/plain'),
('Content-Length', str(len(data))), ('Content-Length', str(len(data))),
('X-Gunicorn-Version', __version__), ('X-Gunicorn-Version', __version__)
("Test", "test тест"),
] ]
start_response(status, response_headers) start_response(status, response_headers)
return iter([data]) return iter([data])

View File

@ -13,4 +13,4 @@ def app(environ, start_response):
log.info("Hello Info!") log.info("Hello Info!")
log.warn("Hello Warn!") log.warn("Hello Warn!")
log.error("Hello Error!") log.error("Hello Error!")
return ["Hello World!\n"] return [b"Hello World!\n"]

View File

@ -9,7 +9,7 @@
# #
# Launch a server with the app in a terminal # Launch a server with the app in a terminal
# #
# $ gunicorn -w3 readline:app # $ gunicorn -w3 readline_app:app
# #
# Then in another terminal launch the following command: # Then in another terminal launch the following command:
# #
@ -27,8 +27,7 @@ def app(environ, start_response):
response_headers = [ response_headers = [
('Content-type', 'text/plain'), ('Content-type', 'text/plain'),
('Transfer-Encoding', "chunked"), ('Transfer-Encoding', "chunked"),
('X-Gunicorn-Version', __version__), ('X-Gunicorn-Version', __version__)
#("Test", "test тест"),
] ]
start_response(status, response_headers) start_response(status, response_headers)
@ -42,4 +41,4 @@ def app(environ, start_response):
print(line) print(line)
lines.append(line) lines.append(line)
return iter(lines) return iter(lines)

View File

@ -20,8 +20,7 @@ def app(environ, start_response):
response_headers = [ response_headers = [
('Content-type', 'text/plain'), ('Content-type', 'text/plain'),
('Content-Length', str(len(data))), ('Content-Length', str(len(data))),
('X-Gunicorn-Version', __version__), ('X-Gunicorn-Version', __version__)
#("Test", "test тест"),
] ]
start_response(status, response_headers) start_response(status, response_headers)
return iter([data]) return iter([data])