Merge pull request #699 from sajith/3294.incident-reporter-to-nevow

Remove nevow from allmydata.web.root.IncidentReporter
This commit is contained in:
Sajith Sasidharan 2020-04-27 10:12:27 -04:00 committed by GitHub
commit e2c6d288bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

0
newsfragments/3294.minor Normal file
View File

View File

@ -28,7 +28,7 @@ from allmydata.web.common import (
WebError,
get_arg,
MultiFormatPage,
RenderMixin,
MultiFormatResource,
get_format,
get_mutable_type,
render_time_delta,
@ -177,14 +177,18 @@ class FileHandler(resource.Resource, object):
raise WebError("/file must be followed by a file-cap and a name",
http.NOT_FOUND)
class IncidentReporter(RenderMixin, rend.Page):
def render_POST(self, ctx):
req = IRequest(ctx)
class IncidentReporter(MultiFormatResource):
"""Handler for /report_incident POST request"""
def render(self, req):
if req.method != "POST":
raise WebError("/report_incident can only be used with POST")
log.msg(format="User reports incident through web page: %(details)s",
details=get_arg(req, "details", ""),
level=log.WEIRD, umid="LkD9Pw")
req.setHeader("content-type", "text/plain")
return "An incident report has been saved to logs/incidents/ in the node directory."
req.setHeader("content-type", "text/plain; charset=UTF-8")
return b"An incident report has been saved to logs/incidents/ in the node directory."
SPACE = u"\u00A0"*2