Skip to content
Snippets Groups Projects

uniform_weblog_digging: Strings where strings are wanted, and the extended...

Merged Jim Sheckard requested to merge uniform_weblog_fixes into main
1 unresolved thread
1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
@@ -182,7 +182,7 @@ class WorkflowWorkingDirRestService:
},
)
redirect_url = self.generate_url_from_path(index_path, results_path)
redirect_url = self.generate_url_from_path(str(index_path), str(results_path))
return Response(status_int=http.HTTPStatus.FOUND, location=redirect_url)
@view_config(request_method="GET", route_name="get_qa_notes", renderer="json")
@@ -202,7 +202,7 @@ class WorkflowWorkingDirRestService:
)
qa_notes_text = ""
with open(qa_notes_path, "r") as qa_notes:
with open(str(qa_notes_path), "r") as qa_notes:
    • If this was a Path instance before, this shouldn't be necessary.

      In fact, if it was a Path instance before, it should be possible to replace this entire block with qa_notes_text = qa_notes.text().

Please register or sign in to reply
qa_notes_text = qa_notes.read()
return Response(status_int=http.HTTPStatus.OK, json_body={"resp": f"{qa_notes_text}"})
@@ -223,7 +223,7 @@ class WorkflowWorkingDirRestService:
},
)
with open(qa_notes_path, "w") as qa_notes:
with open(str(qa_notes_path), "w") as qa_notes:
# sanitize input before writing/persisting
# \\u0000 is an invalid character that is incompatible with postgres json columns
# from StackOverflow: https://stackoverflow.com/questions/63092267/how-to-handle-api-responsesjson-containing-x00-or-u0000-in-its-data-and-s
@@ -309,11 +309,11 @@ class WorkflowWorkingDirRestService:
def generate_url_from_path(self, root_path, results_path):
current_url = self.request.current_route_url()
return current_url.replace("/weblog", "/dir") + root_path.replace(results_path, "") + "/html/index.html"
return current_url.replace("/weblog", "/dir") + root_path.replace(results_path, "")
def generate_qa_notes_path(self, root_path, results_path):
current_url = self.request.current_route_url()
return current_url.replace("/qa_notes", "/dir") + root_path.replace(results_path, "") + "/html/qa_notes.html"
return current_url.replace("/qa_notes", "/dir") + root_path.replace(results_path, "")
@view_defaults(route_name="workflow_request", renderer="json")
Loading