mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-30 09:48:56 +00:00
Fail better when timings data isn't available
This commit is contained in:
parent
112cfc1da5
commit
51d6307b45
@ -707,7 +707,9 @@ class DownloadStatusElement(Element):
|
|||||||
return tag(str(self.download_results().file_size))
|
return tag(str(self.download_results().file_size))
|
||||||
|
|
||||||
def _get_time(self, name):
|
def _get_time(self, name):
|
||||||
return self.download_results().timings.get(name)
|
if self.download_results().timings:
|
||||||
|
return self.download_results().timings.get(name)
|
||||||
|
return None
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def time_total(self, req, tag):
|
def time_total(self, req, tag):
|
||||||
@ -748,7 +750,9 @@ class DownloadStatusElement(Element):
|
|||||||
def _get_rate(self, name):
|
def _get_rate(self, name):
|
||||||
r = self.download_results()
|
r = self.download_results()
|
||||||
file_size = r.file_size
|
file_size = r.file_size
|
||||||
duration = r.timings.get(name)
|
duration = None
|
||||||
|
if r.timings:
|
||||||
|
duration = r.timings.get(name)
|
||||||
return compute_rate(file_size, duration)
|
return compute_rate(file_size, duration)
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
|
Loading…
Reference in New Issue
Block a user