Added returned type to python backend and frontend
This commit is contained in:
@@ -54,12 +54,12 @@ def xpath(source: str, xpath: str) -> str:
|
||||
# root.xpath can return 4 types: float, string, bool and list.
|
||||
# List is the only one that can't be simply converted to str
|
||||
if type(result) is not list:
|
||||
return str(result)
|
||||
return str(result), type(result).__name__
|
||||
else:
|
||||
result_string = ""
|
||||
for e in result:
|
||||
result_string += etree.tostring(e, pretty_print=True).decode() + "\n"
|
||||
return result_string
|
||||
return result_string, "list"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ def process_xml(request: request, type: str) -> str:
|
||||
elif (type == "xslt"):
|
||||
response_json['result'] = Parser.xslt(data, process)
|
||||
elif (type == "xpath"):
|
||||
response_json['result'] = Parser.xpath(data, process)
|
||||
response_json['result'], response_json['type'] = Parser.xpath(data, process)
|
||||
elif (type == "prettify"):
|
||||
response_json['result'] = Parser.formatXML(data, True)
|
||||
elif (type == "minimize"):
|
||||
|
||||
@@ -244,7 +244,7 @@ function performRequest(endpoint, checkXML, checkTransform) {
|
||||
if (!empty) {
|
||||
restRequest(port, endpoint, xmlData, transformData).then(function (result) {
|
||||
document.getElementById("resultArea").value = result.result;
|
||||
document.getElementById("procinfo").innerText = ' Computed using '.concat(" ", result.processor);
|
||||
document.getElementById("procinfo").innerText = ' Computed using '.concat(" ", result.processor, ". Returned: ", result.type);
|
||||
if (result.status = "OK") {
|
||||
document.getElementById("procinfo").innerText = document.getElementById("procinfo").innerText.concat(" in ", result.time, "ms");
|
||||
procinfo.style.color = "#30aa58";
|
||||
|
||||
Reference in New Issue
Block a user