From 8377244c467ab30470617d80e623f3314baf82db Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 21 Apr 2008 17:29:12 -0700 Subject: [PATCH] mutable status: make the 'total' timing value optional: unit tests fail otherwise --- src/allmydata/web/status.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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") -- 2.45.2