Skip to content

Commit

Permalink
Return an error 404 when a screenshot is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
flashcode committed Apr 21, 2024
1 parent 7948b92 commit 14d4fba
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 62 deletions.
8 changes: 2 additions & 6 deletions weechat/about/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

from django import __version__ as django_version
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Sum
from django.shortcuts import render
from django.shortcuts import render, get_object_or_404
from django.utils.translation import gettext

from weechat.about.models import (
Expand All @@ -46,10 +45,7 @@ def screenshots(request, app='weechat', filename=''):
or all screenshots as thumbnails.
"""
if filename:
try:
screenshot = Screenshot.objects.get(app=app, filename=filename)
except ObjectDoesNotExist:
screenshot = None
screenshot = get_object_or_404(Screenshot, app=app, filename=filename)
return render(
request,
'about/screenshots.html',
Expand Down
10 changes: 3 additions & 7 deletions weechat/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat.org\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-07 19:12+0200\n"
"PO-Revision-Date: 2024-03-26 12:59+0100\n"
"POT-Creation-Date: 2024-04-21 22:07+0200\n"
"PO-Revision-Date: 2024-04-21 22:07+0200\n"
"Last-Translator: Nils Görs <[email protected]>\n"
"Language-Team: German <[email protected]>\n"
"Language: de_DE\n"
Expand Down Expand Up @@ -7822,11 +7822,7 @@ msgstr "Screenshots"
msgid "Relay clients"
msgstr "Relay Clients"

#: templates/about/screenshots.html:43
msgid "Screenshot not found:"
msgstr "Bildschirmfoto nicht gefunden:"

#: templates/about/screenshots.html:47
#: templates/about/screenshots.html:42
msgid "No screenshot."
msgstr "Kein Bildschirmfoto."

Expand Down
10 changes: 3 additions & 7 deletions weechat/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat.org\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-07 19:12+0200\n"
"PO-Revision-Date: 2024-04-07 19:13+0200\n"
"POT-Creation-Date: 2024-04-21 22:07+0200\n"
"PO-Revision-Date: 2024-04-21 22:07+0200\n"
"Last-Translator: Sébastien Helleu <[email protected]>\n"
"Language-Team: French <[email protected]>\n"
"Language: fr\n"
Expand Down Expand Up @@ -7754,11 +7754,7 @@ msgstr "captures d'écran"
msgid "Relay clients"
msgstr "Clients de relay"

#: templates/about/screenshots.html:43
msgid "Screenshot not found:"
msgstr "Capture d'écran non trouvée :"

#: templates/about/screenshots.html:47
#: templates/about/screenshots.html:42
msgid "No screenshot."
msgstr "Pas de capture d'écran."

Expand Down
11 changes: 3 additions & 8 deletions weechat/locale/it/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat.org\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-07 19:12+0200\n"
"PO-Revision-Date: 2023-08-22 12:21+0200\n"
"POT-Creation-Date: 2024-04-21 22:07+0200\n"
"PO-Revision-Date: 2024-04-21 22:07+0200\n"
"Last-Translator: Marco Paolone <[email protected]>\n"
"Language-Team: Italian <[email protected]>\n"
"Language: it\n"
Expand Down Expand Up @@ -6524,12 +6524,7 @@ msgstr "schermate"
msgid "Relay clients"
msgstr ""

#: templates/about/screenshots.html:43
#, fuzzy
msgid "Screenshot not found:"
msgstr "Script non trovato"

#: templates/about/screenshots.html:47
#: templates/about/screenshots.html:42
#, fuzzy
msgid "No screenshot."
msgstr "schermate"
Expand Down
14 changes: 5 additions & 9 deletions weechat/locale/ja/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat.org\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-07 19:12+0200\n"
"PO-Revision-Date: 2023-12-03 20:15+0100\n"
"POT-Creation-Date: 2024-04-21 22:07+0200\n"
"PO-Revision-Date: 2024-04-21 22:07+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <[email protected]>\n"
"Language-Team: Japanese <https://github.com/l/weechat.org/tree/master/"
"translation/ja_JP>\n"
Expand Down Expand Up @@ -3503,8 +3503,8 @@ msgstr ""
"- オプション logger.look.backlog_conditions を追加\n"
"- スクリプトプラグイン毎の設定ファイルを追加 (\"python.conf\"\"perl."
"conf\"、...)\n"
"- script コマンドに \"eval\" オプションを追加、インフォ "
"\"xxx_eval\" (python、perl、ruby、lua、guile) を追加\n"
"- script コマンドに \"eval\" オプションを追加、インフォ \"xxx_eval\" "
"(python、perl、ruby、lua、guile) を追加\n"
"- スクリプトプラグインにインフォ \"xxx_interpreter\"\"xxx_version\" を追"
"加\n"
"- script コマンドにオプション \"version\" を追加\n"
Expand Down Expand Up @@ -7536,11 +7536,7 @@ msgstr "スクリーンショット"
msgid "Relay clients"
msgstr "リレークライアント"

#: templates/about/screenshots.html:43
msgid "Screenshot not found:"
msgstr "スクリーンショットは見つかりません:"

#: templates/about/screenshots.html:47
#: templates/about/screenshots.html:42
msgid "No screenshot."
msgstr "スクリーンショットがありません。"

Expand Down
20 changes: 8 additions & 12 deletions weechat/locale/pl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat.org\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-07 19:12+0200\n"
"PO-Revision-Date: 2024-01-31 21:12+0100\n"
"POT-Creation-Date: 2024-04-21 22:07+0200\n"
"PO-Revision-Date: 2024-04-21 22:07+0200\n"
"Last-Translator: Krzysztof Korościk <[email protected]>\n"
"Language-Team: Polish <[email protected]>\n"
"Language: pl\n"
Expand Down Expand Up @@ -3570,8 +3570,8 @@ msgstr ""
"- dodano opcję logger.look.backlog_conditions\n"
"- dodano pliki konfiguracyjne dla każdej wtyczki (\"python.conf\", \"perl."
"conf\", ...)\n"
"- dodano opcję \"eval\" w komendach skryptów oraz informację "
"\"xxx_eval\" (python, perl, ruby, lua, guile)\n"
"- dodano opcję \"eval\" w komendach skryptów oraz informację \"xxx_eval\" "
"(python, perl, ruby, lua, guile)\n"
"- dodano informacje \"xxx_interpreter\" i \"xxx_version\" we wtyczkach "
"skryptów\n"
"- dodano opcję \"version\" w komendach skryptów\n"
Expand Down Expand Up @@ -4133,9 +4133,9 @@ msgstr ""
"- ulepszono możliwości debugowania w komendzie /eval\n"
"- dodano opcje \"setvar\" i \"delvar\" w komendzie /bufer, zmieniono nazwy "
"opcji \"localvar\" na \"listvar\"\n"
"- dodano zmienną lokalną bufrów "
"\"completion_default_template\" (przetwarzana) nadpisującą wartość opcji "
"weechat.completion.default_template\n"
"- dodano zmienną lokalną bufrów \"completion_default_template\" "
"(przetwarzana) nadpisującą wartość opcji weechat.completion."
"default_template\n"
"- dodano opcję \"recreate\" dla komendy /filter\n"
"- dodano przetwarzanie surowych ciągów w wyrażeniach za pomocą \"raw:xxx\"\n"
"- dodano przetwarzanie warunków podczas przetwarzania wyrażeń za pomocą "
Expand Down Expand Up @@ -7616,11 +7616,7 @@ msgstr "zrzuty ekranu"
msgid "Relay clients"
msgstr "Zdalne interfejsy"

#: templates/about/screenshots.html:43
msgid "Screenshot not found:"
msgstr "Nie znaleziono zrzutu ekranu:"

#: templates/about/screenshots.html:47
#: templates/about/screenshots.html:42
msgid "No screenshot."
msgstr "Brak zrzutu ekranu."

Expand Down
10 changes: 3 additions & 7 deletions weechat/locale/pt_BR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat.org\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-07 19:12+0200\n"
"PO-Revision-Date: 2023-12-03 20:15+0100\n"
"POT-Creation-Date: 2024-04-21 22:07+0200\n"
"PO-Revision-Date: 2024-04-21 22:07+0200\n"
"Last-Translator: Alexandre Bolelli <[email protected]>\n"
"Language-Team: Portuguese <[email protected]>\n"
"Language: pt_BR\n"
Expand Down Expand Up @@ -6967,11 +6967,7 @@ msgstr "captura de tela"
msgid "Relay clients"
msgstr ""

#: templates/about/screenshots.html:43
msgid "Screenshot not found:"
msgstr "Captura de tela não encontrada:"

#: templates/about/screenshots.html:47
#: templates/about/screenshots.html:42
msgid "No screenshot."
msgstr "Sem capturas de tela."

Expand Down
6 changes: 0 additions & 6 deletions weechat/templates/about/screenshots.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ <h4>{{ screenshot.comment|linebreaksbr|urlize }}</h4>

{% else %}

{% if filename %}
<div class="alert alert-danger">
{% trans "Screenshot not found:" %} {{ filename }}
</div>
{% else %}
<p>
{% trans "No screenshot." %}
</p>
{% endif %}

{% endif %}

Expand Down

0 comments on commit 14d4fba

Please sign in to comment.