misc: use minimal default 404 page when templating is down (#42162)
gitea-wip/combo/pipeline/head Build started... Details
gitea/combo/pipeline/head Build started... Details

This commit is contained in:
Frédéric Péters 2020-04-27 19:40:47 +02:00
parent 67a6caaf70
commit a621919221
2 changed files with 3 additions and 1 deletions

View File

@ -0,0 +1,2 @@
<h1>Not Found</h1>
<p>The requested resource was not found on this server.</p>

View File

@ -567,7 +567,7 @@ def error404(request, *args, **kwargs):
if Page.objects.exists() and all((not x.is_visible(request.user) for x in Page.objects.filter(parent_id__isnull=True))):
# if none of the first-level pages can be viewed by the user, display
# native django error page.
return page_not_found(request, *args, **kwargs)
return page_not_found(request, *args, template_name='combo/native-404.html', **kwargs)
try:
page = Page.objects.get(slug='404')