From: Brian Warner Date: Wed, 24 Oct 2007 00:35:31 +0000 (-0700) Subject: webish: tolerate not having a checker, since some unit tests don't make one X-Git-Tag: allmydata-tahoe-0.7.0~354 X-Git-Url: https://git.rkrishnan.org/pf/content/install.html?a=commitdiff_plain;h=42bd2bcf8ed1a91b9f8a1a83395cff06331fb479;p=tahoe-lafs%2Ftahoe-lafs.git webish: tolerate not having a checker, since some unit tests don't make one --- diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index 88bbc9ab..ecde7f67 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -227,22 +227,29 @@ class Directory(rend.Page): ctx.fillSlots("data", childdata) - checker = IClient(ctx).getServiceNamed("checker") - checker_results = checker.checker_results_for(target.get_verifier()) - recent_results = reversed(checker_results[-5:]) - if IFileNode.providedBy(target): - results = ("[" + - ", ".join(["%d/%d" % (found, needed) - for (when, (needed, total, found, sharemap)) - in recent_results]) + - "]") - elif IDirectoryNode.providedBy(target): - results = ("[" + - "".join([{True:"+",False:"-"}[res] - for (when, res) in recent_results]) + - "]") + try: + checker = IClient(ctx).getServiceNamed("checker") + except KeyError: + checker = None + if checker: + checker_results = checker.checker_results_for(target.get_verifier()) + recent_results = reversed(checker_results[-5:]) + if IFileNode.providedBy(target): + results = ("[" + + ", ".join(["%d/%d" % (found, needed) + for (when, + (needed, total, found, sharemap)) + in recent_results]) + + "]") + elif IDirectoryNode.providedBy(target): + results = ("[" + + "".join([{True:"+",False:"-"}[res] + for (when, res) in recent_results]) + + "]") + else: + results = "%d results" % len(checker_results) else: - results = "%d results" % len(checker_results) + results = "--" ctx.fillSlots("checker_results", results) return ctx.tag