Merge pull request #822 from sajith/3429.return-errorpage-from-check-results

Return ErrorPage from web.check_results

Fixes ticket:3429
This commit is contained in:
Sajith Sasidharan 2020-09-22 20:40:00 -04:00 committed by GitHub
commit 9aee312d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

0
newsfragments/3429.minor Normal file
View File

View File

@ -15,8 +15,10 @@ from twisted.web.template import (
tags,
)
from allmydata.web.common import (
exception_to_child,
get_arg,
get_root,
render_exception,
WebError,
MultiFormatResource,
SlotsSequenceElement,
@ -224,9 +226,11 @@ class LiteralCheckResultsRenderer(MultiFormatResource, ResultsBase):
super(LiteralCheckResultsRenderer, self).__init__()
self._client = client
@render_exception
def render_HTML(self, req):
return renderElement(req, LiteralCheckResultsRendererElement())
@render_exception
def render_JSON(self, req):
req.setHeader("content-type", "text/plain")
data = json_check_results(None)
@ -275,9 +279,11 @@ class CheckResultsRenderer(MultiFormatResource):
self._client = client
self._results = ICheckResults(results)
@render_exception
def render_HTML(self, req):
return renderElement(req, CheckResultsRendererElement(self._client, self._results))
@render_exception
def render_JSON(self, req):
req.setHeader("content-type", "text/plain")
data = json_check_results(self._results)
@ -343,10 +349,12 @@ class CheckAndRepairResultsRenderer(MultiFormatResource):
if results:
self._results = ICheckAndRepairResults(results)
@render_exception
def render_HTML(self, req):
elem = CheckAndRepairResultsRendererElement(self._client, self._results)
return renderElement(req, elem)
@render_exception
def render_JSON(self, req):
req.setHeader("content-type", "text/plain")
data = json_check_and_repair_results(self._results)
@ -411,6 +419,7 @@ class DeepCheckResultsRenderer(MultiFormatResource):
self._client = client
self.monitor = monitor
@exception_to_child
def getChild(self, name, req):
if not name:
return self
@ -425,10 +434,12 @@ class DeepCheckResultsRenderer(MultiFormatResource):
raise WebError("No detailed results for SI %s" % html.escape(name),
http.NOT_FOUND)
@render_exception
def render_HTML(self, req):
elem = DeepCheckResultsRendererElement(self.monitor)
return renderElement(req, elem)
@render_exception
def render_JSON(self, req):
req.setHeader("content-type", "text/plain")
data = {}
@ -615,6 +626,7 @@ class DeepCheckAndRepairResultsRenderer(MultiFormatResource):
self._client = client
self.monitor = monitor
@exception_to_child
def getChild(self, name, req):
if not name:
return self
@ -629,10 +641,12 @@ class DeepCheckAndRepairResultsRenderer(MultiFormatResource):
raise WebError("No detailed results for SI %s" % html.escape(name),
http.NOT_FOUND)
@render_exception
def render_HTML(self, req):
elem = DeepCheckAndRepairResultsRendererElement(self.monitor)
return renderElement(req, elem)
@render_exception
def render_JSON(self, req):
req.setHeader("content-type", "text/plain")
res = self.monitor.get_status()