From 89ed178b6a2ae6580d58da21568c081b4f2fd701 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 1 Oct 2022 09:28:11 +0200 Subject: [PATCH] Remove unused cache on attachment urls --- src/attachments/tests/test_views.py | 2 -- src/attachments/views.py | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/src/attachments/tests/test_views.py b/src/attachments/tests/test_views.py index 91fdde6..8a3c30a 100644 --- a/src/attachments/tests/test_views.py +++ b/src/attachments/tests/test_views.py @@ -34,7 +34,6 @@ def test_view_original(attachment: Attachment, client: Client) -> None: res = client.get(url) assert res.status_code == 302 assert res.url == attachment.original_file.url - assert "Last-Modified" in res.headers def test_view_processed(attachment: Attachment, client: Client) -> None: @@ -42,4 +41,3 @@ def test_view_processed(attachment: Attachment, client: Client) -> None: res = client.get(url) assert res.status_code == 302 assert res.url == attachment.processed_file.url - assert "Last-Modified" in res.headers diff --git a/src/attachments/views.py b/src/attachments/views.py index 5d761f9..fc452ae 100644 --- a/src/attachments/views.py +++ b/src/attachments/views.py @@ -1,25 +1,15 @@ -import datetime - from django.core.handlers.wsgi import WSGIRequest from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404 -from django.views.decorators.http import last_modified from attachments.models import Attachment -def get_updated_at(request: WSGIRequest, pk: int) -> datetime.datetime: - attachment = get_object_or_404(Attachment, pk=pk) - return attachment.updated_at - - -@last_modified(get_updated_at) def get_original(request: WSGIRequest, pk: int) -> HttpResponse: attachment = get_object_or_404(Attachment, pk=pk) return HttpResponseRedirect(attachment.original_file.url) -@last_modified(get_updated_at) def get_processed(request: WSGIRequest, pk: int) -> HttpResponse: attachment = get_object_or_404(Attachment, pk=pk) return HttpResponseRedirect(attachment.processed_file.url)