diff wsgraph/web.py @ 6:259210f2e029

more formatter stubbing
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 10 Dec 2012 13:48:11 -0800
parents 9d5a8c90c482
children 9016b126aa87
line wrap: on
line diff
--- a/wsgraph/web.py	Mon Dec 10 07:54:10 2012 -0800
+++ b/wsgraph/web.py	Mon Dec 10 13:48:11 2012 -0800
@@ -13,9 +13,9 @@
 EDGE = 2
 
 # XXX stubbing hacks
-def JSONFormatter(**kwargs):
-    return json.dumps(kwargs, sort_keys=True)
-def JSONGraphFormatter(graph):
+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)
@@ -78,7 +78,15 @@
 
         A graph formatter takes the following arguments:
 
-          def sample_graph_formatter(graph, request):
+            def sample_graph_formatter(graph, request):
+
+        A node formatter takes the following arguments:
+
+            def sample_node_formatter(node, graph, request):
+
+        An edge formatter takes the following arguments:
+
+            def sample_edge_formatter(edge, graph, request):
 
         API: