From 1326214c8f26916117812460d3e8cdc8da5a1fba Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 16 Jul 2022 01:13:48 +0100 Subject: [PATCH] Rename namespace for static pygments URL --- website/common/templates/common/content_page.html | 2 +- website/contrib/code_block/tests.py | 10 +++------- website/contrib/code_block/urls.py | 8 ++++++-- website/urls.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/website/common/templates/common/content_page.html b/website/common/templates/common/content_page.html index c06adcd..fa398b9 100644 --- a/website/common/templates/common/content_page.html +++ b/website/common/templates/common/content_page.html @@ -17,7 +17,7 @@ {% block extra_css %} - + {% endblock %} {% block extra_js %} diff --git a/website/contrib/code_block/tests.py b/website/contrib/code_block/tests.py index d398fcd..964baff 100644 --- a/website/contrib/code_block/tests.py +++ b/website/contrib/code_block/tests.py @@ -9,21 +9,17 @@ class PygmentsStylesTestCase(TestCase): def test_accessible(self) -> None: for style in get_all_styles(): with self.subTest(style=style): - response = self.client.get( - reverse("static-pygments:styles", args=[style]) - ) + response = self.client.get(reverse("code-block:styles", args=[style])) self.assertEqual(response.status_code, 200) self.assertEqual(response["Cache-Control"], "max-age=3600, public") self.assertEqual(response["ETag"], f'"{PYGMENTS_VERSION}"') def test_unknown_style(self) -> None: - response = self.client.get( - reverse("static-pygments:styles", args=["not-a-style"]) - ) + response = self.client.get(reverse("code-block:styles", args=["not-a-style"])) self.assertEqual(response.status_code, 404) def test_url_contains_version(self) -> None: for style in get_all_styles(): with self.subTest(style=style): - url = reverse("static-pygments:styles", args=[style]) + url = reverse("code-block:styles", args=[style]) self.assertIn(PYGMENTS_VERSION_SLUG, url) diff --git a/website/contrib/code_block/urls.py b/website/contrib/code_block/urls.py index 1b9b84a..f9e3882 100644 --- a/website/contrib/code_block/urls.py +++ b/website/contrib/code_block/urls.py @@ -3,9 +3,13 @@ from django.urls import path from .utils import PYGMENTS_VERSION_SLUG from .views import pygments_styles -app_name = "code_block" +app_name = "code-block" urlpatterns = [ # HACK: Bake the pygments version into the URL, without needing a custom method - path(f".{PYGMENTS_VERSION_SLUG}.css", pygments_styles, name="styles") + path( + f"pygments-.{PYGMENTS_VERSION_SLUG}.css", + pygments_styles, + name="styles", + ) ] diff --git a/website/urls.py b/website/urls.py index 0277ba0..2746ccd 100644 --- a/website/urls.py +++ b/website/urls.py @@ -14,8 +14,8 @@ urlpatterns = [ path("documents/", include(wagtaildocs_urls)), path("search/", search_views.search, name="search"), path( - "static-pygments/", - include("website.contrib.code_block.urls", namespace="static-pygments"), + "code-block/", + include("website.contrib.code_block.urls"), ), re_path( r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$",