from paste request import parse_formvars def app environ start_respons

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from paste.request import parse_formvars
def app(environ, start_response):
fields = parse_formvars(environ)
if environ['REQUEST_METHOD'] == 'POST':
start_response('200 OK', [('content-type', 'text/html')])
return ['Hello, ', fields['name'], '!']
else:
start_response('200 OK', [('content-type', 'text/html')])
return ['<form method="POST">Name: <input type="text" '
'name="name"><input type="submit"></form>']