Wrap renderer results in tags

This commit is contained in:
Sajith Sasidharan 2020-05-14 15:28:00 -04:00
parent 68df408229
commit 88e8854ad4

View File

@ -683,39 +683,39 @@ class DownloadStatusElement(Element):
@renderer @renderer
def time_total(self, req, tag): def time_total(self, req, tag):
return self._get_time("total") return tag(str(self._get_time("total")))
@renderer @renderer
def time_peer_selection(self, req, tag): def time_peer_selection(self, req, tag):
return self._get_time("peer_selection") return tag(str(self._get_time("peer_selection")))
@renderer @renderer
def time_uri_extension(self, req, tag): def time_uri_extension(self, req, tag):
return self._get_time("uri_extension") return tag(str(self._get_time("uri_extension")))
@renderer @renderer
def time_hashtrees(self, req, tag): def time_hashtrees(self, req, tag):
return self._get_time("hashtrees") return tag(str(self._get_time("hashtrees")))
@renderer @renderer
def time_segments(self, req, tag): def time_segments(self, req, tag):
return self._get_time("segments") return tag(str(self._get_time("segments")))
@renderer @renderer
def time_cumulative_fetch(self, req, tag): def time_cumulative_fetch(self, req, tag):
return self._get_time("cumulative_fetch") return tag(str(self._get_time("cumulative_fetch")))
@renderer @renderer
def time_cumulative_decode(self, req, tag): def time_cumulative_decode(self, req, tag):
return self._get_time("cumulative_decode") return tag(str(self._get_time("cumulative_decode")))
@renderer @renderer
def time_cumulative_decrypt(self, req, tag): def time_cumulative_decrypt(self, req, tag):
return self._get_time("cumulative_decrypt") return tag(str(self._get_time("cumulative_decrypt")))
@renderer @renderer
def time_paused(self, req, tag): def time_paused(self, req, tag):
return self._get_time("paused") return tag(str(self._get_time("paused")))
def _get_rate(self, name): def _get_rate(self, name):
d = self.download_results() d = self.download_results()
@ -728,23 +728,23 @@ class DownloadStatusElement(Element):
@renderer @renderer
def rate_total(self, req, tag): def rate_total(self, req, tag):
return self._get_rate("total") return tag(str(self._get_rate("total")))
@renderer @renderer
def rate_segments(self, req, tag): def rate_segments(self, req, tag):
return self._get_rate("segments") return tag(str(self._get_rate("segments")))
@renderer @renderer
def rate_fetch(self, req, tag): def rate_fetch(self, req, tag):
return self._get_rate("cumulative_fetch") return tag(str(self._get_rate("cumulative_fetch")))
@renderer @renderer
def rate_decode(self, req, tag): def rate_decode(self, req, tag):
return self._get_rate("cumulative_decode") return tag(str(self._get_rate("cumulative_decode")))
@renderer @renderer
def rate_decrypt(self, req, tag): def rate_decrypt(self, req, tag):
return self._get_rate("cumulative_decrypt") return tag(str(self._get_rate("cumulative_decrypt")))
@renderer @renderer
def server_timings(self, req, tag): def server_timings(self, req, tag):
@ -756,7 +756,7 @@ class DownloadStatusElement(Element):
ul = tags.ul() ul = tags.ul()
for peerid in sorted(per_server.keys()): for peerid in sorted(per_server.keys()):
peerid_s = idlib.shortnodeid_b2a(peerid) peerid_s = idlib.shortnodeid_b2a(peerid)
times_s = ", ".join([self.render_time(None, t) times_s = ", ".join([abbreviate_time(t)
for t in per_server[peerid]]) for t in per_server[peerid]])
ul(tags.li("[%s]: %s" % (peerid_s, times_s))) ul(tags.li("[%s]: %s" % (peerid_s, times_s)))
return tags.li("Per-Server Segment Fetch Response Times: ", ul) return tags.li("Per-Server Segment Fetch Response Times: ", ul)