Add error handling, fixed a bug, etc.

This commit is contained in:
Elliott Pardee 2020-01-04 15:09:25 -05:00
parent 35f60a955a
commit aa9196b755
7 changed files with 44 additions and 7 deletions

View File

@ -18,6 +18,7 @@
import os
import flask
import werkzeug
from canon_law import central
@ -34,4 +35,6 @@ def create_app():
app.register_blueprint(api.bp)
app.register_blueprint(frontend.bp)
app.register_error_handler(werkzeug.exceptions.HTTPException, frontend.error_page)
return app

View File

@ -17,6 +17,7 @@
"""
import flask
import werkzeug
import tinydb
import random
@ -40,7 +41,7 @@ page_titles = {
def index():
return flask.render_template("index.html")
@bp.route("/c/")
@bp.route("/c/<council>/")
def read_council(council=None):
if council in page_titles.keys():
@ -75,3 +76,8 @@ def about():
@bp.route("/disclaimer/")
def disclaimer():
return flask.render_template("disclaimer.html")
@bp.errorhandler(werkzeug.exceptions.HTTPException)
def error_page(error):
return flask.render_template("error.html", error=error), error.code

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -70,7 +70,7 @@ button:focus {
color: white !important;
}
input { padding: 10px; }
input { padding: 10px; border-radius: -1px; }
header .dropdown-content {
display: none;
@ -128,8 +128,7 @@ footer {
}
table {
display: block;
margin: 0 auto;
display: table-cell;
}
table, th, td {

View File

@ -12,8 +12,21 @@
<br><br>
<h3>Personnel</h3>
<h6 style="margin-top: -10px;">(Title: Name, Jurisdiction - Email)</h6>
Project Lead: Seraphim Pardee, OCA - <a href="mailto:vypr@oikonomia.xyz">vypr@oikonomia.xyz</a>
<table>
<tr>
<th>role</th>
<th>name</th>
<th>jurisdiction</th>
<th>email</th>
</tr>
<tr>
<td>project lead</td>
<td><a href="https://vypr.xyz">Seraphim</a></td>
<td>OCA / Bulgarian Diocese</td>
<td><a href="mailto:vypr@oikonomia.xyz">click</a></td>
</tr>
</table>
<br><br>

View File

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block title %}error {{ error.code }}{% endblock %}
{% block main %}
<h1>{{ error.code }}</h1>
<h3 style="text-align: center;">
{% if error.code == 404 %}
<img src="{{ url_for('static', filename='phanurius.jpg') }}">
<br>
You can pray to St. Phanourios to help you find what you are looking for.
{% else %}
{{ error.description }}
{% endif %}
</h3>
{% endblock %}

View File

@ -10,6 +10,6 @@
<br><br>
Wanna try a <a href="{{ url_for('frontend.council', council=random_council) }}">random council</a>?
Wanna try a <a href="{{ url_for('frontend.read_council', council=random_council) }}">random council</a>?
</h3>
{% endblock %}