view example/example.py @ 21:1b9545d5158a

add a screenshot
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 02 Jan 2011 21:17:23 -0800
parents aa4eab6dc994
children 1b077cb84be5
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)
    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()