view example/example.py @ 5:65acb32e8dc3

dont use boxes
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 28 Dec 2010 17:14:34 -0800
parents 30d03e830354
children aa4eab6dc994
line wrap: on
line source

import os
from svgsitemap import *
from webob import Request, Response

def example(environ, start_response):
    link = '<a href="/%s">%s</a>'
    body = '<br/>'.join([link % (i,i) for i in range(30)])
    body = '<html><body><a href="/map">map</a><br/>%s</body></html>' % body
    response = Response(content_type='text/html', body=body)
    return response(environ, start_response)

def factory():
    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, name='foo.com')
    return app

if __name__ == '__main__':
    from wsgiref import simple_server
    server = simple_server.make_server(host='0.0.0.0', port=int(54321), app=factory())
    server.serve_forever()