import cgi from paste.deploy.config import CONFIG def application(environ, start_response): # Note that usually you wouldn't be writing a pure WSGI # application, you might be using some framework or # environment. But as an example... start_response('200 OK', [('Content-type', 'text/html')]) greeting = CONFIG['greeting'] content = [ b'%s\n' % greeting.encode('utf-8'), b'

%s!

\n' % greeting.encode('utf-8'), b'\n', ] items = environ.items() items = sorted(items) for key, value in items: content.append(b'\n' % (key.encode('utf-8'), cgi.escape(repr(value)).encode('utf-8'))) content.append(b'
%s%s
') return content