mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 03:14:21 +00:00
Remove nevow from allmydata.web.root.IncidentReporter
This change calls for an explanation: - `RenderMixin` doesn't seem to be adding anything here, so it is gone. - The web browser was unhappy without a charset in the response (Firefox 74 was anyway), so `content-type` header also gets a `charset=UTF-8`. - Returning a Unicode string made nevow appserver unhappy, so it is just a `str`. The precise error message was: exceptions.TypeError: ('Could not adapt', u'An incident report has been saved to logs/incidents/ in the node directory.', <InterfaceClass nevow.inevow.IResource>) Fixes: ticket:3294
This commit is contained in:
parent
34e85ac515
commit
a14cee5cce
0
newsfragments/3294.minor
Normal file
0
newsfragments/3294.minor
Normal file
@ -28,7 +28,7 @@ from allmydata.web.common import (
|
||||
WebError,
|
||||
get_arg,
|
||||
MultiFormatPage,
|
||||
RenderMixin,
|
||||
MultiFormatResource,
|
||||
get_format,
|
||||
get_mutable_type,
|
||||
render_time_delta,
|
||||
@ -169,14 +169,15 @@ class FileHandler(rend.Page):
|
||||
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):
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user