~ubuntu-branches/ubuntu/hardy/pastedeploy/hardy

« back to all changes in this revision

Viewing changes to paste/deploy/paster_templates/paste_deploy/+package+/sampleapp.py_tmpl

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ozarowski
  • Date: 2006-05-14 03:27:56 UTC
  • Revision ID: james.westby@ubuntu.com-20060514032756-qqd7u23ijat2ccbf
Tags: upstream-0.5
ImportĀ upstreamĀ versionĀ 0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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