annotate example/example.py @ 0:7a60bacc6a22

initial commit
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 27 Dec 2010 22:09:09 -0800
parents
children 084088505eea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 from svgsitemap import *
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 from webob import Request, Response
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 def example(environ, start_response):
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 link = '<a href="/%s">%s</a>'
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 body = '<br/>'.join([link % (i,i) for i in range(30)])
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 body = '<html><body>%s</body></html>' % body
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 response = Response(content_type='text/plain', body=body)
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 return response(environ, start_response)
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 def factory():
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 import pdb; pdb.set_trace()
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 app = MapserverMiddleware(example)
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 if __name__ == '__main__':
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 from wsgiref import simple_server
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 server = simple_server.make_server(host=host, port=int(54321), app=factory())
7a60bacc6a22 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 server.serve_forever()