From: Brian Warner Date: Tue, 22 Apr 2008 00:29:12 +0000 (-0700) Subject: mutable status: make the 'total' timing value optional: unit tests fail otherwise X-Git-Tag: allmydata-tahoe-1.1.0~200 X-Git-Url: https://git.rkrishnan.org/uri/%3C?a=commitdiff_plain;h=8377244c467ab30470617d80e623f3314baf82db;p=tahoe-lafs%2Ftahoe-lafs.git mutable status: make the 'total' timing value optional: unit tests fail otherwise --- diff --git a/src/allmydata/web/status.py b/src/allmydata/web/status.py index 83e3773a..1ea0305a 100644 --- a/src/allmydata/web/status.py +++ b/src/allmydata/web/status.py @@ -710,7 +710,7 @@ class MapupdateStatusPage(rend.Page, RateAndTimeMixin): def _timing_chart(self): started = self.update_status.get_started() - total = self.update_status.timings["total"] + total = self.update_status.timings.get("total") per_server = self.update_status.timings.get("per_server") base = "http://chart.apis.google.com/chart?" pieces = ["cht=bhs", "chs=400x300"] @@ -759,10 +759,11 @@ class MapupdateStatusPage(rend.Page, RateAndTimeMixin): # mathutil.next_power_of_k doesn't handle numbers smaller than one, # unfortunately. #pieces.append("chg=" - # this chm=r thing is being interpreted as 1.0=fullscale - finished_f = 1.0 * total / top_rel - pieces.append("chm=r,FF0000,0,%0.3f,%0.3f" % (finished_f, - finished_f+0.01)) + + if total is not None: + finished_f = 1.0 * total / top_rel + pieces.append("chm=r,FF0000,0,%0.3f,%0.3f" % (finished_f, + finished_f+0.01)) url = base + "&".join(pieces) return T.img(src=url, align="right", float="right")