From 37cf2b8b1138ede74fe3bb37d746a1c568cd2136 Mon Sep 17 00:00:00 2001 From: krzywon Date: Tue, 22 Oct 2024 13:26:30 -0400 Subject: [PATCH] Check if documentation path exists. Show 404 error if not found --- src/sas/qtgui/Utilities/DocViewWidget.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sas/qtgui/Utilities/DocViewWidget.py b/src/sas/qtgui/Utilities/DocViewWidget.py index b1bc136b47..2a0ae421f9 100644 --- a/src/sas/qtgui/Utilities/DocViewWidget.py +++ b/src/sas/qtgui/Utilities/DocViewWidget.py @@ -180,16 +180,16 @@ def regenerateIfNeeded(self): self.regenerateHtml(self.source.name) # Test to see if HTML does not exist or is older than python file - elif self.newer(self.source, url_str): - self.regenerateHtml(self.source.name) + elif not os.path.exists(url_str): + self.load404() # Regenerate RST then HTML if no model file found OR if HTML is older than equivalent .py elif "index" in url_str: # Regenerate if HTML is older than RST -- for index.html, which gets passed in differently because it is located in a different folder regen_string = rst_path / str(self.source.name).replace(".html", ".rst") # Test to see if HTML does not exist or is older than python file - if self.newer(regen_string, self.source.absolute()): - self.regenerateHtml(regen_string) + if not os.path.exists(self.source.absolute()): + self.load404() else: # Regenerate if HTML is older than RST @@ -199,8 +199,8 @@ def regenerateIfNeeded(self): html_path = html_path / model_local_path.split('#')[0] # Remove jump links regen_string = rst_path / model_local_path.replace('.html', '.rst').split('#')[0] #Remove jump links # Test to see if HTML does not exist or is older than python file - if self.newer(regen_string, html_path): - self.regenerateHtml(regen_string) + if not os.path.exists(html_path): + self.load404() if self.regen_in_progress is False: self.loadHtml() #loads the html file specified in the source url to the QWebViewer