This commit is contained in:
Daniel Bauer
2024-11-11 09:40:52 +01:00
parent 01affafd7a
commit 8b09f4feb5
9 changed files with 13 additions and 13 deletions

3
.flake8 Normal file
View File

@@ -0,0 +1,3 @@
[flake8]
max-line-length = 99
exclude = .git, __pycache__, .pytest_cache, .venv, venv, build

View File

@@ -36,4 +36,3 @@ class SignpostingMiddleware:
link_snippets[-1] += f' ; type="{signpost.type}"'
response["Link"] = " , ".join(link_snippets)

View File

@@ -13,5 +13,5 @@ def add_signposts(response: HttpResponse, *args: Signpost):
response._signposts = []
for signpost in args:
if not signpost in response._signposts:
if signpost not in response._signposts:
response._signposts.append(signpost)

View File

@@ -14,7 +14,6 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from . import views

View File

@@ -3,6 +3,7 @@ from django_signposting.utils import add_signposts
from signposting import Signpost, LinkRel
def my_view(request):
response = HttpResponse("Hello, world!")

View File

@@ -1,4 +1,3 @@
import pytest
from django.conf import settings

View File

@@ -1,8 +1,8 @@
from re import A
from django.http import HttpResponse
from django_signposting.middleware import SignpostingMiddleware
from signposting import LinkRel, Signpost
def test_middleware_no_signposting():
response = HttpResponse()
response.status_code = 200

View File

@@ -5,7 +5,7 @@ from signposting import Signpost, LinkRel
def test_add_signpost():
response = HttpResponse()
add_signposts(response, Signpost(LinkRel.item,"http://example.com"))
add_signposts(response, Signpost(LinkRel.item, "http://example.com"))
assert len(response._signposts) == 1
@@ -18,7 +18,6 @@ def test_add_multiple_signposts():
Signpost(LinkRel.author, "https://example3.com"),
)
assert len(response._signposts) == 3