mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 08:25:35 +00:00
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:
commit
9aee312d8c
0
newsfragments/3429.minor
Normal file
0
newsfragments/3429.minor
Normal file
@ -15,8 +15,10 @@ from twisted.web.template import (
|
|||||||
tags,
|
tags,
|
||||||
)
|
)
|
||||||
from allmydata.web.common import (
|
from allmydata.web.common import (
|
||||||
|
exception_to_child,
|
||||||
get_arg,
|
get_arg,
|
||||||
get_root,
|
get_root,
|
||||||
|
render_exception,
|
||||||
WebError,
|
WebError,
|
||||||
MultiFormatResource,
|
MultiFormatResource,
|
||||||
SlotsSequenceElement,
|
SlotsSequenceElement,
|
||||||
@ -224,9 +226,11 @@ class LiteralCheckResultsRenderer(MultiFormatResource, ResultsBase):
|
|||||||
super(LiteralCheckResultsRenderer, self).__init__()
|
super(LiteralCheckResultsRenderer, self).__init__()
|
||||||
self._client = client
|
self._client = client
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_HTML(self, req):
|
def render_HTML(self, req):
|
||||||
return renderElement(req, LiteralCheckResultsRendererElement())
|
return renderElement(req, LiteralCheckResultsRendererElement())
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_JSON(self, req):
|
def render_JSON(self, req):
|
||||||
req.setHeader("content-type", "text/plain")
|
req.setHeader("content-type", "text/plain")
|
||||||
data = json_check_results(None)
|
data = json_check_results(None)
|
||||||
@ -275,9 +279,11 @@ class CheckResultsRenderer(MultiFormatResource):
|
|||||||
self._client = client
|
self._client = client
|
||||||
self._results = ICheckResults(results)
|
self._results = ICheckResults(results)
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_HTML(self, req):
|
def render_HTML(self, req):
|
||||||
return renderElement(req, CheckResultsRendererElement(self._client, self._results))
|
return renderElement(req, CheckResultsRendererElement(self._client, self._results))
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_JSON(self, req):
|
def render_JSON(self, req):
|
||||||
req.setHeader("content-type", "text/plain")
|
req.setHeader("content-type", "text/plain")
|
||||||
data = json_check_results(self._results)
|
data = json_check_results(self._results)
|
||||||
@ -343,10 +349,12 @@ class CheckAndRepairResultsRenderer(MultiFormatResource):
|
|||||||
if results:
|
if results:
|
||||||
self._results = ICheckAndRepairResults(results)
|
self._results = ICheckAndRepairResults(results)
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_HTML(self, req):
|
def render_HTML(self, req):
|
||||||
elem = CheckAndRepairResultsRendererElement(self._client, self._results)
|
elem = CheckAndRepairResultsRendererElement(self._client, self._results)
|
||||||
return renderElement(req, elem)
|
return renderElement(req, elem)
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_JSON(self, req):
|
def render_JSON(self, req):
|
||||||
req.setHeader("content-type", "text/plain")
|
req.setHeader("content-type", "text/plain")
|
||||||
data = json_check_and_repair_results(self._results)
|
data = json_check_and_repair_results(self._results)
|
||||||
@ -411,6 +419,7 @@ class DeepCheckResultsRenderer(MultiFormatResource):
|
|||||||
self._client = client
|
self._client = client
|
||||||
self.monitor = monitor
|
self.monitor = monitor
|
||||||
|
|
||||||
|
@exception_to_child
|
||||||
def getChild(self, name, req):
|
def getChild(self, name, req):
|
||||||
if not name:
|
if not name:
|
||||||
return self
|
return self
|
||||||
@ -425,10 +434,12 @@ class DeepCheckResultsRenderer(MultiFormatResource):
|
|||||||
raise WebError("No detailed results for SI %s" % html.escape(name),
|
raise WebError("No detailed results for SI %s" % html.escape(name),
|
||||||
http.NOT_FOUND)
|
http.NOT_FOUND)
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_HTML(self, req):
|
def render_HTML(self, req):
|
||||||
elem = DeepCheckResultsRendererElement(self.monitor)
|
elem = DeepCheckResultsRendererElement(self.monitor)
|
||||||
return renderElement(req, elem)
|
return renderElement(req, elem)
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_JSON(self, req):
|
def render_JSON(self, req):
|
||||||
req.setHeader("content-type", "text/plain")
|
req.setHeader("content-type", "text/plain")
|
||||||
data = {}
|
data = {}
|
||||||
@ -615,6 +626,7 @@ class DeepCheckAndRepairResultsRenderer(MultiFormatResource):
|
|||||||
self._client = client
|
self._client = client
|
||||||
self.monitor = monitor
|
self.monitor = monitor
|
||||||
|
|
||||||
|
@exception_to_child
|
||||||
def getChild(self, name, req):
|
def getChild(self, name, req):
|
||||||
if not name:
|
if not name:
|
||||||
return self
|
return self
|
||||||
@ -629,10 +641,12 @@ class DeepCheckAndRepairResultsRenderer(MultiFormatResource):
|
|||||||
raise WebError("No detailed results for SI %s" % html.escape(name),
|
raise WebError("No detailed results for SI %s" % html.escape(name),
|
||||||
http.NOT_FOUND)
|
http.NOT_FOUND)
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_HTML(self, req):
|
def render_HTML(self, req):
|
||||||
elem = DeepCheckAndRepairResultsRendererElement(self.monitor)
|
elem = DeepCheckAndRepairResultsRendererElement(self.monitor)
|
||||||
return renderElement(req, elem)
|
return renderElement(req, elem)
|
||||||
|
|
||||||
|
@render_exception
|
||||||
def render_JSON(self, req):
|
def render_JSON(self, req):
|
||||||
req.setHeader("content-type", "text/plain")
|
req.setHeader("content-type", "text/plain")
|
||||||
res = self.monitor.get_status()
|
res = self.monitor.get_status()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user