Mercurial > hg > WSGraph
comparison wsgraph/web.py @ 19:8162dc8dd93a
fix this thing
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 10 Dec 2012 17:44:11 -0800 |
parents | b710a2374c8d |
children | 542232f858a9 |
comparison
equal
deleted
inserted
replaced
18:b710a2374c8d | 19:8162dc8dd93a |
---|---|
18 | 18 |
19 def __init__(self, content_type='application/json', sort_keys=True): | 19 def __init__(self, content_type='application/json', sort_keys=True): |
20 self.content_type = content_type | 20 self.content_type = content_type |
21 self.sort_keys = sort_keys | 21 self.sort_keys = sort_keys |
22 | 22 |
23 def format(self, _object): | 23 def format(self, instance): |
24 return json.dumps(graph.node(node), sort_keys=self.sort_keys) | 24 """front-end to json.dumps""" |
25 return json.dumps(instance, sort_keys=self.sort_keys) | |
25 | 26 |
26 def node(self, node, graph, request): | 27 def node(self, node, graph, request): |
27 return Response(content_type=self.content_type, | 28 return Response(content_type=self.content_type, |
28 body=self.format(graph.node(node))) | 29 body=self.format(graph.node(node))) |
29 | 30 |