Removing raw markdown from python files for error handling and added error handling pages.

This commit is contained in:
Robert Tice
2017-11-21 17:20:22 -05:00
parent 1ce5b8d703
commit dc449d11ed
4 changed files with 10 additions and 3 deletions

View File

@@ -12,6 +12,7 @@
<div class="wrapper">
<h3>AdaCore Books</h3>
<br>
<ul class="list-unstyled components">
{% for b in books %}
<li><a href="books/{{ b.url }}/part1-chapter1">{{ b.title }}</a></li>

View File

@@ -165,9 +165,12 @@ def book_router(request, book, part, chapter):
with open(content_page, 'r') as f:
htmldata['content'] = f.read()
else:
htmldata['content'] = "# Page Under Construction"
with open(os.path.join(resources_base_path,
"under-construction.md")) as f:
htmldata['content'] = f.read()
else:
htmldata['content'] = "### The page you have reached is invalid. " \
"Please use the links at the left to navigate to a valid page."
with open(os.path.join(resources_base_path,
"invalid-page.md")) as f:
htmldata['content'] = f.read()
return render(request, 'readerpage.html', htmldata)

View File

@@ -0,0 +1,2 @@
# The page you have reached is invalid.
### Please use the links at the left to navigate to a valid page.

View File

@@ -0,0 +1 @@
# Page Under Construction