on master help sign in
Merge pull request #671 from kvch/custom-404

Custom 404 message - fixes #317

commit3043c404e42901a1234d150e43daee99810b46f5 authorAdam Tauber <asciimoo@gmail.com> dateSat 27 Aug 2016, 22:08 (10 years ago) parentb72aec00056c40
6 files changed+38
searx/templates/courgette/404.html+7 searx/templates/default/404.html+7 searx/templates/oscar/404.html+7 searx/templates/pix-art/404.html+7 searx/webapp.py+5 tests/robot/test_basic.robot+5
searx/templates/courgette/404.htmlnew file+7
@@ -0,0 +1,7 @@
1+{% extends "courgette/base.html" %}
2+{% block content %}
3+<div class="center">
4+ <h1>{{ _('Page not found') }}</h1>
5+ <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6+</div>
7+{% endblock %}
searx/templates/default/404.htmlnew file+7
@@ -0,0 +1,7 @@
1+{% extends "default/base.html" %}
2+{% block content %}
3+<div class="center">
4+ <h1>{{ _('Page not found') }}</h1>
5+ <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6+</div>
7+{% endblock %}
searx/templates/oscar/404.htmlnew file+7
@@ -0,0 +1,7 @@
1+{% extends "oscar/base.html" %}
2+{% block content %}
3+<div class="text-center">
4+ <h1>{{ _('Page not found') }}</h1>
5+ <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6+</div>
7+{% endblock %}
searx/templates/pix-art/404.htmlnew file+7
@@ -0,0 +1,7 @@
1+{% extends "pix-art/base.html" %}
2+{% block content %}
3+<div class="center">
4+ <h1>{{ _('Page not found') }}</h1>
5+ <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6+</div>
7+{% endblock %}
searx/webapp.py+5
@@ -715,6 +715,11 @@ def config():
715715 'default_theme': settings['ui']['default_theme']})
716716
717717
718+@app.errorhandler(404)
719+def page_not_found(e):
720+ return render('404.html')
721+
722+
718723def run():
719724 app.run(
720725 debug=settings['general']['debug'],
tests/robot/test_basic.robot+5
@@ -9,6 +9,11 @@ Front page
99 Page Should Contain about
1010 Page Should Contain preferences
1111
12+404 page
13+ Go To http://localhost:11111/no-such-page
14+ Page Should Contain Page not found
15+ Page Should Contain Go to search page
16+
1217About page
1318 Click Element link=about
1419 Page Should Contain Why use searx?