diff example/example.py @ 1:084088505eea

almost working
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 28 Dec 2010 16:23:07 -0800
parents 7a60bacc6a22
children 30d03e830354
line wrap: on
line diff
--- a/example/example.py	Mon Dec 27 22:09:09 2010 -0800
+++ b/example/example.py	Tue Dec 28 16:23:07 2010 -0800
@@ -1,3 +1,4 @@
+import os
 from svgsitemap import *
 from webob import Request, Response
 
@@ -5,14 +6,18 @@
     link = '<a href="/%s">%s</a>'
     body = '<br/>'.join([link % (i,i) for i in range(30)])
     body = '<html><body>%s</body></html>' % body
-    response = Response(content_type='text/plain', body=body)
+    response = Response(content_type='text/html', body=body)
     return response(environ, start_response)
 
 def factory():
-    import pdb; pdb.set_trace()
-    app = MapserverMiddleware(example)
+    dirname = os.path.dirname(os.path.abspath(__file__))
+    inifile = os.path.join(dirname, 'example.gv.txt')
+    svgfile = os.path.join(dirname, 'example.svg')
+    app = MapserverMiddleware(example, svgfile)
+    app = SVGSiteMap(app, file=inifile, output=svgfile)
+    return app
 
 if __name__ == '__main__':
     from wsgiref import simple_server
-    server = simple_server.make_server(host=host, port=int(54321), app=factory())
+    server = simple_server.make_server(host='0.0.0.0', port=int(54321), app=factory())
     server.serve_forever()