diff wsgraph/web.py @ 17:1053290ba067

finish up this throwaway thing
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 10 Dec 2012 17:36:31 -0800
parents 569a5d93b8e3
children b710a2374c8d
line wrap: on
line diff
--- a/wsgraph/web.py	Mon Dec 10 17:34:14 2012 -0800
+++ b/wsgraph/web.py	Mon Dec 10 17:36:31 2012 -0800
@@ -24,12 +24,8 @@
     def node(self, node, graph, request):
         return Response(body=self.format(graph.node(node)))
 
-def JSONFormatter(node, graph, request):
-    return json.dumps(graph.node(node), sort_keys=True)
-def JSONGraphFormatter(graph, request):
-    return json.dumps({'nodes': graph.nodes(),
-                       'edges': graph.edges()},
-                      sort_keys=True)
+    def edge(self, node1, node2, graph, request):
+        return Response(body=self.format(graph.edge(node)))
 
 class Dispatcher(object):
 
@@ -112,8 +108,7 @@
         if rank not in (0,1,2):
             return exc.HTTPNotFound()
 
-
-        # is resource in the graph? [TODO]
+        # is resource in the graph?
         if (rank == EDGE) or (rank == NODE):
             if tuple(segments) not in self.graph:
                 return exc.HTTPNotFound()