diff options
author | Josh Blum | 2013-06-11 00:32:47 -0700 |
---|---|---|
committer | Josh Blum | 2013-06-11 00:32:47 -0700 |
commit | 41c8e89795675cd0989aee8e88647abd941c000c (patch) | |
tree | 90cb800bbada4c165cdddf9b03a5f1c4b19ebca9 /query | |
parent | 39b7a04a8ddac19fa694abdb963e861dc6adeee2 (diff) | |
download | sandhi-41c8e89795675cd0989aee8e88647abd941c000c.tar.gz sandhi-41c8e89795675cd0989aee8e88647abd941c000c.tar.bz2 sandhi-41c8e89795675cd0989aee8e88647abd941c000c.zip |
flow: added query flat flow dot format
Diffstat (limited to 'query')
-rw-r--r-- | query/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/query/__init__.py b/query/__init__.py index dc3339c..28c11a4 100644 --- a/query/__init__.py +++ b/query/__init__.py @@ -26,6 +26,17 @@ class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): args = server_registry[s.server] path = o.path + if path == "/flow.png": + s.send_response(200) + s.send_header("Content-type", "image/png") + s.end_headers() + dot = args['top_block'].query(json.dumps(dict(path='/flows.dot'))) + import subprocess + open("/tmp/dot.dot", 'w').write(dot) + subprocess.check_call(["dot", "-T", "png", "-o", "/tmp/dot.png", "/tmp/dot.dot"]) + s.wfile.write(open("/tmp/dot.png").read()) + return + #handle json requests if path.endswith('.json'): s.send_response(200) |