Tweak some examples.

* Return bytes in Python 3
* Activate wsgiref.validate.validator
* Remove unused imports
This commit is contained in:
Berker Peksag 2015-07-08 13:53:19 +03:00
parent dddfcb2826
commit b5d188422e
5 changed files with 10 additions and 18 deletions

View File

@ -13,7 +13,7 @@
def load(arg):
def app(environ, start_response):
data = 'Hello, %s!\n' % arg
data = b'Hello, %s!\n' % arg
status = '200 OK'
response_headers = [
('Content-type', 'text/plain'),

View File

@ -5,20 +5,15 @@
#
# Example code from Eventlet sources
import os
import pprint
from wsgiref.validate import validator
import sys
from gunicorn import __version__
#@validator
@validator
def app(environ, start_response):
"""Simplest possible application object"""
errors = environ['wsgi.errors']
# pprint.pprint(('ENVIRON', environ), stream=errors)
print(environ)
if environ['REQUEST_METHOD'].upper() != 'POST':
data = b'Hello, World!\n'
else:

View File

@ -16,7 +16,7 @@
try:
from routes import Mapper
except:
except ImportError:
print("This example requires Routes to be installed")
# Obviously you'd import your app callables

View File

@ -8,7 +8,8 @@
import os
from wsgiref.validate import validator
#@validator
@validator
def app(environ, start_response):
"""Simplest possible application object"""
status = '200 OK'

View File

@ -5,19 +5,15 @@
#
# Example code from Eventlet sources
import os
import pprint
from wsgiref.validate import validator
import sys
from gunicorn import __version__
#@validator
@validator
def app(environ, start_response):
"""Simplest possible application object"""
errors = environ['wsgi.errors']
# pprint.pprint(('ENVIRON', environ), stream=errors)
data = b'Hello, World!\n'
status = '200 OK'