webish: tolerate not having a checker, since some unit tests don't make one
This commit is contained in:
parent
046bda2b47
commit
42bd2bcf8e
|
@ -227,13 +227,18 @@ class Directory(rend.Page):
|
||||||
|
|
||||||
ctx.fillSlots("data", childdata)
|
ctx.fillSlots("data", childdata)
|
||||||
|
|
||||||
|
try:
|
||||||
checker = IClient(ctx).getServiceNamed("checker")
|
checker = IClient(ctx).getServiceNamed("checker")
|
||||||
|
except KeyError:
|
||||||
|
checker = None
|
||||||
|
if checker:
|
||||||
checker_results = checker.checker_results_for(target.get_verifier())
|
checker_results = checker.checker_results_for(target.get_verifier())
|
||||||
recent_results = reversed(checker_results[-5:])
|
recent_results = reversed(checker_results[-5:])
|
||||||
if IFileNode.providedBy(target):
|
if IFileNode.providedBy(target):
|
||||||
results = ("[" +
|
results = ("[" +
|
||||||
", ".join(["%d/%d" % (found, needed)
|
", ".join(["%d/%d" % (found, needed)
|
||||||
for (when, (needed, total, found, sharemap))
|
for (when,
|
||||||
|
(needed, total, found, sharemap))
|
||||||
in recent_results]) +
|
in recent_results]) +
|
||||||
"]")
|
"]")
|
||||||
elif IDirectoryNode.providedBy(target):
|
elif IDirectoryNode.providedBy(target):
|
||||||
|
@ -243,6 +248,8 @@ class Directory(rend.Page):
|
||||||
"]")
|
"]")
|
||||||
else:
|
else:
|
||||||
results = "%d results" % len(checker_results)
|
results = "%d results" % len(checker_results)
|
||||||
|
else:
|
||||||
|
results = "--"
|
||||||
ctx.fillSlots("checker_results", results)
|
ctx.fillSlots("checker_results", results)
|
||||||
|
|
||||||
return ctx.tag
|
return ctx.tag
|
||||||
|
|
Loading…
Reference in New Issue