fix deep-stats results

This commit is contained in:
meejah 2019-09-11 16:09:11 -06:00
parent 7a36bdc523
commit b4d9bfea15
1 changed files with 7 additions and 1 deletions

View File

@ -1295,18 +1295,24 @@ class DeepSizeResults(MultiFormatPage):
} }
return json.dumps(status) return json.dumps(status)
class DeepStatsResults(Resource): class DeepStatsResults(Resource):
"""
Renders the results of a 'deep-stats' operation on a directory
capability.
"""
def __init__(self, client, monitor): def __init__(self, client, monitor):
self.client = client self.client = client
self.monitor = monitor self.monitor = monitor
def renderHTTP(self, req): def render(self, req):
# JSON only # JSON only
req.setHeader("content-type", "text/plain") req.setHeader("content-type", "text/plain")
s = self.monitor.get_status().copy() s = self.monitor.get_status().copy()
s["finished"] = self.monitor.is_finished() s["finished"] = self.monitor.is_finished()
return json.dumps(s, indent=1) return json.dumps(s, indent=1)
@implementer(IPushProducer) @implementer(IPushProducer)
class ManifestStreamer(dirnode.DeepStats): class ManifestStreamer(dirnode.DeepStats):