1
|
1 import os
|
0
|
2 from svgsitemap import *
|
|
3 from webob import Request, Response
|
|
4
|
|
5 def example(environ, start_response):
|
|
6 link = '<a href="/%s">%s</a>'
|
|
7 body = '<br/>'.join([link % (i,i) for i in range(30)])
|
2
|
8 body = '<html><body><a href="/map">map</a><br/>%s</body></html>' % body
|
1
|
9 response = Response(content_type='text/html', body=body)
|
0
|
10 return response(environ, start_response)
|
|
11
|
|
12 def factory():
|
1
|
13 dirname = os.path.dirname(os.path.abspath(__file__))
|
|
14 inifile = os.path.join(dirname, 'example.gv.txt')
|
|
15 svgfile = os.path.join(dirname, 'example.svg')
|
|
16 app = MapserverMiddleware(example, svgfile)
|
2
|
17 app = SVGSiteMap(app, file=inifile, output=svgfile, name='foo.com')
|
1
|
18 return app
|
0
|
19
|
|
20 if __name__ == '__main__':
|
|
21 from wsgiref import simple_server
|
1
|
22 server = simple_server.make_server(host='0.0.0.0', port=int(54321), app=factory())
|
0
|
23 server.serve_forever()
|