From 28f07f772994363a8fbb68fcbb2f2596f9f3ddd5 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 29 Mar 2021 18:47:21 -0700 Subject: [PATCH 1/2] Fixes error pages --- bookwyrm/templates/{notfound.html => 404.html} | 0 bookwyrm/templates/{error.html => 500.html} | 0 bookwyrm/templates/directory/directory.html | 4 ++-- bookwyrm/urls.py | 2 -- bookwyrm/views/error.py | 12 ------------ 5 files changed, 2 insertions(+), 16 deletions(-) rename bookwyrm/templates/{notfound.html => 404.html} (100%) rename bookwyrm/templates/{error.html => 500.html} (100%) delete mode 100644 bookwyrm/views/error.py diff --git a/bookwyrm/templates/notfound.html b/bookwyrm/templates/404.html similarity index 100% rename from bookwyrm/templates/notfound.html rename to bookwyrm/templates/404.html diff --git a/bookwyrm/templates/error.html b/bookwyrm/templates/500.html similarity index 100% rename from bookwyrm/templates/error.html rename to bookwyrm/templates/500.html diff --git a/bookwyrm/templates/directory/directory.html b/bookwyrm/templates/directory/directory.html index 7413f67d..430e8539 100644 --- a/bookwyrm/templates/directory/directory.html +++ b/bookwyrm/templates/directory/directory.html @@ -44,9 +44,9 @@
- + {% include 'snippets/avatar.html' with user=user large=True %} - +
{{ user.display_name }} diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 5d8bc5e9..33c4aaad 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -23,8 +23,6 @@ status_path = r"%s/(%s)/(?P\d+)" % (user_path, "|".join(status_types) book_path = r"^book/(?P\d+)" -handler404 = "bookwyrm.views.not_found_page" -handler500 = "bookwyrm.views.server_error_page" urlpatterns = [ path("admin/", admin.site.urls), path( diff --git a/bookwyrm/views/error.py b/bookwyrm/views/error.py deleted file mode 100644 index 9bd94ca3..00000000 --- a/bookwyrm/views/error.py +++ /dev/null @@ -1,12 +0,0 @@ -""" something has gone amiss """ -from django.template.response import TemplateResponse - - -def server_error_page(request): - """ 500 errors """ - return TemplateResponse(request, "error.html", status=500) - - -def not_found_page(request, _): - """ 404s """ - return TemplateResponse(request, "notfound.html", status=404) From 4b325fedee43c1f77251ef8a4230fa02a8dc6ae6 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 29 Mar 2021 18:51:35 -0700 Subject: [PATCH 2/2] Removes error views from init --- bookwyrm/views/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bookwyrm/views/__init__.py b/bookwyrm/views/__init__.py index dc71d359..693a7744 100644 --- a/bookwyrm/views/__init__.py +++ b/bookwyrm/views/__init__.py @@ -5,7 +5,6 @@ from .block import Block, unblock from .books import Book, EditBook, ConfirmEditBook, Editions from .books import upload_cover, add_description, switch_edition, resolve_book from .directory import Directory -from .error import not_found_page, server_error_page from .federation import Federation, FederatedServer from .feed import DirectMessage, Feed, Replies, Status from .follow import follow, unfollow