Skip to content

Commit

Permalink
Check if documentation path exists. Show 404 error if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
krzywon committed Oct 22, 2024
1 parent b010fb9 commit debf847
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sas/qtgui/Utilities/DocViewWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,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
Expand All @@ -200,8 +200,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
Expand Down

0 comments on commit debf847

Please sign in to comment.