Commit c9e33166 authored by Julien Muchembled's avatar Julien Muchembled

demo: add links between route and tunnels pages

parent 09a8ff1a
...@@ -217,8 +217,10 @@ if len(sys.argv) > 1: ...@@ -217,8 +217,10 @@ if len(sys.argv) > 1:
def do_GET(self): def do_GET(self):
svg = None svg = None
if self.path == '/route.html': if self.path == '/route.html':
other = 'tunnel'
svg = route_svg() svg = route_svg()
elif self.path == '/tunnel.html': elif self.path == '/tunnel.html':
other = 'route'
gv = registry.Popen(('python', '-c', r"""if 1: gv = registry.Popen(('python', '-c', r"""if 1:
import math, xmlrpclib import math, xmlrpclib
g = xmlrpclib.ServerProxy('http://localhost/').topology() g = xmlrpclib.ServerProxy('http://localhost/').topology()
...@@ -241,16 +243,21 @@ if len(sys.argv) > 1: ...@@ -241,16 +243,21 @@ if len(sys.argv) > 1:
if not svg: if not svg:
self.send_error(500) self.send_error(500)
return return
else:
if self.path == '/':
self.send_response(302)
self.send_header('Location', 'route.html')
self.end_headers()
else: else:
self.send_error(404) self.send_error(404)
return return
mt = 'text/html' mt = 'text/html'
body = """<html> body = """<html>
<head><meta http-equiv="refresh" content="10"/></head> <head><meta http-equiv="refresh" content="10"/></head>
<body> <body><a style="position: absolute" href="%s.html">%ss</a>
%s %s
</body> </body>
</html>""" % svg[svg.find('<svg'):] </html>""" % (other, other, svg[svg.find('<svg'):])
self.send_response(200) self.send_response(200)
self.send_header('Content-Length', len(body)) self.send_header('Content-Length', len(body))
self.send_header('Content-type', mt + '; charset=utf-8') self.send_header('Content-type', mt + '; charset=utf-8')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment