add configurable contact email for error pages

This commit is contained in:
Brian S. Stephan 2021-02-23 13:11:52 -06:00
parent 085571e58f
commit 70a8d4f06a
4 changed files with 11 additions and 5 deletions

View File

@ -48,7 +48,9 @@ class Config(object):
},
}
DEFAULT_PAGE_STYLE = 'light'
TITLE_SUFFIX = 'incorporeal.org'
MEDIA_DIR = 'media'
# customizations
DEFAULT_PAGE_STYLE = 'light'
TITLE_SUFFIX = 'incorporeal.org'
CONTACT_EMAIL = 'bss@incorporeal.org'

View File

@ -11,7 +11,7 @@
<h1>NOT FOUND</h1>
<p>Sorry, <b><tt>{{ request.path }}</tt></b> does not seem to exist, at least not anymore.</p>
<p>It's possible you followed a dead link on this site, in which case I would appreciate it if you could email me via:
bss @ &lt;this domain&gt; and I can take a look. I make an effort to symlink old content to its new location,
{{ config.CONTACT_EMAIL }} and I can take a look. I make an effort to symlink old content to its new location,
so old links and URLs should, generally speaking, work.</p>
<p>Otherwise, I suggest you go <a href="/">to the index</a> and navigate your way (hopefully) to what
you're looking for.</p>

View File

@ -9,6 +9,6 @@
{% block body %}
<div class="content">
<h1>INTERNAL SERVER ERROR</h1>
<p>Something bad happened! Please email me at bss @ &lt;this domain&gt; and tell me what happened.</p>
<p>Something bad happened! Please email me at {{ config.CONTACT_EMAIL }} and tell me what happened.</p>
</div>
{% endblock %}

View File

@ -14,6 +14,8 @@ def test_page_that_doesnt_exist(client):
response = client.get('/ohuesthaoeusth')
assert response.status_code == 404
assert b'<b><tt>/ohuesthaoeusth</tt></b> does not seem to exist' in response.data
# test the contact email config
assert b'bss@incorporeal.org' in response.data
def test_files_outside_pages_do_not_get_served(client):
@ -28,6 +30,8 @@ def test_internal_server_error_serves_error_page(client):
response = client.get('/actually-a-png')
assert response.status_code == 500
assert b'INTERNAL SERVER ERROR' in response.data
# test the contact email config
assert b'bss@incorporeal.org' in response.data
def test_weird_paths_do_not_get_served(client):