ソースを参照

Merge pull request #671 from kvch/custom-404

Custom 404 message - fixes #317
Adam Tauber 8 年 前
コミット
3043c404e4
共有6 個のファイルを変更した38 個の追加0 個の削除を含む
  1. 7
    0
      searx/templates/courgette/404.html
  2. 7
    0
      searx/templates/default/404.html
  3. 7
    0
      searx/templates/oscar/404.html
  4. 7
    0
      searx/templates/pix-art/404.html
  5. 5
    0
      searx/webapp.py
  6. 5
    0
      tests/robot/test_basic.robot

+ 7
- 0
searx/templates/courgette/404.html ファイルの表示

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 %}

+ 7
- 0
searx/templates/default/404.html ファイルの表示

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 %}

+ 7
- 0
searx/templates/oscar/404.html ファイルの表示

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 %}

+ 7
- 0
searx/templates/pix-art/404.html ファイルの表示

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 %}

+ 5
- 0
searx/webapp.py ファイルの表示

715
                     'default_theme': settings['ui']['default_theme']})
715
                     'default_theme': settings['ui']['default_theme']})
716
 
716
 
717
 
717
 
718
+@app.errorhandler(404)
719
+def page_not_found(e):
720
+    return render('404.html')
721
+
722
+
718
 def run():
723
 def run():
719
     app.run(
724
     app.run(
720
         debug=settings['general']['debug'],
725
         debug=settings['general']['debug'],

+ 5
- 0
tests/robot/test_basic.robot ファイルの表示

9
     Page Should Contain  about
9
     Page Should Contain  about
10
     Page Should Contain  preferences
10
     Page Should Contain  preferences
11
 
11
 
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
+
12
 About page
17
 About page
13
     Click Element  link=about
18
     Click Element  link=about
14
     Page Should Contain  Why use searx?
19
     Page Should Contain  Why use searx?