Minor improvements

This commit is contained in:
Miroslav Štampar
2026-06-29 22:20:22 +02:00
parent 820efa7a8a
commit 7b60bc8284
11 changed files with 626 additions and 104 deletions
+3 -3
View File
@@ -986,7 +986,7 @@ class ReqHandler(BaseHTTPRequestHandler):
elements = root.xpath(xpath_expr)
entries = [_xpath_element_to_dict(el) for el in elements]
except Exception as ex:
error = "%s: %s" % (type(ex).__name__, getUnicode(ex))
error = "%s: %s" % (type(ex).__name__, str(ex))
output = json.dumps({"entries": entries, "count": len(entries), "error": error}, default=str)
self.wfile.write(output.encode(UNICODE_ENCODING))
@@ -1013,7 +1013,7 @@ class ReqHandler(BaseHTTPRequestHandler):
if results:
authenticated = True
except Exception as ex:
error = "%s: %s" % (type(ex).__name__, getUnicode(ex))
error = "%s: %s" % (type(ex).__name__, str(ex))
output = json.dumps({"authenticated": authenticated, "error": error}, default=str)
self.wfile.write(output.encode(UNICODE_ENCODING))
@@ -1036,7 +1036,7 @@ class ReqHandler(BaseHTTPRequestHandler):
output += template.render()
except Exception as ex:
# Leak template engine error for error-based detection
output += "<b>%s: %s</b>" % (type(ex).__name__, getUnicode(ex))
output += "<b>%s: %s</b>" % (type(ex).__name__, str(ex))
else:
output += "Hello"