mirror of
https://github.com/dnlbauer/django-signposting.git
synced 2026-09-10 14:05:31 +00:00
linting
This commit is contained in:
3
.flake8
Normal file
3
.flake8
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[flake8]
|
||||||
|
max-line-length = 99
|
||||||
|
exclude = .git, __pycache__, .pytest_cache, .venv, venv, build
|
||||||
@@ -36,4 +36,3 @@ class SignpostingMiddleware:
|
|||||||
link_snippets[-1] += f' ; type="{signpost.type}"'
|
link_snippets[-1] += f' ; type="{signpost.type}"'
|
||||||
|
|
||||||
response["Link"] = " , ".join(link_snippets)
|
response["Link"] = " , ".join(link_snippets)
|
||||||
|
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ def add_signposts(response: HttpResponse, *args: Signpost):
|
|||||||
response._signposts = []
|
response._signposts = []
|
||||||
|
|
||||||
for signpost in args:
|
for signpost in args:
|
||||||
if not signpost in response._signposts:
|
if signpost not in response._signposts:
|
||||||
response._signposts.append(signpost)
|
response._signposts.append(signpost)
|
||||||
@@ -14,7 +14,6 @@ Including another URLconf
|
|||||||
1. Import the include() function: from django.urls import include, path
|
1. Import the include() function: from django.urls import include, path
|
||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from django_signposting.utils import add_signposts
|
|||||||
|
|
||||||
from signposting import Signpost, LinkRel
|
from signposting import Signpost, LinkRel
|
||||||
|
|
||||||
|
|
||||||
def my_view(request):
|
def my_view(request):
|
||||||
response = HttpResponse("Hello, world!")
|
response = HttpResponse("Hello, world!")
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import pytest
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from re import A
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django_signposting.middleware import SignpostingMiddleware
|
from django_signposting.middleware import SignpostingMiddleware
|
||||||
from signposting import LinkRel, Signpost
|
from signposting import LinkRel, Signpost
|
||||||
|
|
||||||
|
|
||||||
def test_middleware_no_signposting():
|
def test_middleware_no_signposting():
|
||||||
response = HttpResponse()
|
response = HttpResponse()
|
||||||
response.status_code = 200
|
response.status_code = 200
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from signposting import Signpost, LinkRel
|
|||||||
|
|
||||||
def test_add_signpost():
|
def test_add_signpost():
|
||||||
response = HttpResponse()
|
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
|
assert len(response._signposts) == 1
|
||||||
|
|
||||||
@@ -18,7 +18,6 @@ def test_add_multiple_signposts():
|
|||||||
Signpost(LinkRel.author, "https://example3.com"),
|
Signpost(LinkRel.author, "https://example3.com"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
assert len(response._signposts) == 3
|
assert len(response._signposts) == 3
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user