[3] | 1 | import cgi |
---|
| 2 | from paste.deploy import CONFIG |
---|
| 3 | |
---|
| 4 | def application(environ, start_response): |
---|
| 5 | # Note that usually you wouldn't be writing a pure WSGI |
---|
| 6 | # application, you might be using some framework or |
---|
| 7 | # environment. But as an example... |
---|
| 8 | start_response('200 OK', [('Content-type', 'text/html')]) |
---|
| 9 | greeting = CONFIG['greeting'] |
---|
| 10 | content = [ |
---|
| 11 | '<html><head><title>%s</title></head>\n' % greeting, |
---|
| 12 | '<body><h1>%s!</h1>\n' % greeting, |
---|
| 13 | '<table border=1>\n', |
---|
| 14 | ] |
---|
| 15 | items = environ.items() |
---|
| 16 | items.sort() |
---|
| 17 | for key, value in items: |
---|
| 18 | content.append('<tr><td>%s</td><td>%s</td></tr>\n' |
---|
| 19 | % (key, cgi.escape(repr(value)))) |
---|
| 20 | content.append('</table></body></html>') |
---|
| 21 | return content |
---|
| 22 | |
---|
| 23 | |
---|