Make ResultsBase a base class of CheckResultsRendererElement

This commit is contained in:
Sajith Sasidharan 2020-06-03 21:42:20 -04:00
parent fea4e516f3
commit 8e37bb1ebb

View File

@ -261,7 +261,7 @@ class CheckerBase(object):
return ""
class CheckResultsRenderer(MultiFormatResource, ResultsBase):
class CheckResultsRenderer(MultiFormatResource):
formatArgument = "output"
@ -276,7 +276,7 @@ class CheckResultsRenderer(MultiFormatResource, ResultsBase):
self.r = ICheckResults(results)
def render_HTML(self, req):
return renderElement(req, CheckResultsRendererElement(self.r))
return renderElement(req, CheckResultsRendererElement(self.client, self.r))
def render_JSON(self, req):
req.setHeader("content-type", "text/plain")
@ -284,12 +284,13 @@ class CheckResultsRenderer(MultiFormatResource, ResultsBase):
return json.dumps(data, indent=1) + "\n"
class CheckResultsRendererElement(Element, CheckerBase):
class CheckResultsRendererElement(Element, CheckerBase, ResultsBase):
loader = XMLFile(FilePath(__file__).sibling("check-results.xhtml"))
def __init__(self, r):
def __init__(self, client, r):
super(CheckResultsRendererElement, self).__init__()
self.client = client
# TODO: use a better name
self.r = r