Web UI: Fix str vs bytes mess in error message handling

Displaying the error message failed resulting in an empty page and a
(hidden) trace back.

Resolves: #180
This commit is contained in:
Florian Festi 2019-10-22 21:12:26 +02:00
parent 927f483c19
commit 55dd81886a
1 changed files with 7 additions and 7 deletions

View File

@ -382,19 +382,19 @@ class BServer:
def errorMessage(self, name, e, _): def errorMessage(self, name, e, _):
return [ return [
b"""<html> ("""<html>
<head> <head>
<title>""", _("Error generating %s") % _(name).encode(), <title>""" + _("Error generating %s") % _(name) +
b"""</title> """</title>
<meta name="flattr:id" content="456799"> <meta name="flattr:id" content="456799">
</head> </head>
<body> <body>
<h1>""" + _("An error occurred!") + "</h1>", <h1>""" + _("An error occurred!") + "</h1>" +
u"".join(u"<p>%s</p>" % cgi.escape(s) for s in type(u"")(e).split(u"\n")).encode('utf-8'), "".join(u"<p>%s</p>" % cgi.escape(s) for s in type(u"")(e).split(u"\n")) +
b""" """
</body> </body>
</html> </html>
""" ] """).encode("utf-8") ]
def serveStatic(self, environ, start_response): def serveStatic(self, environ, start_response):
filename = environ["PATH_INFO"][len("/static/"):] filename = environ["PATH_INFO"][len("/static/"):]