diff --git a/.github/ISSUE_TEMPLATE/BUG.yml b/.github/ISSUE_TEMPLATE/BUG.yml index f75b4a61c..56c2b89f9 100644 --- a/.github/ISSUE_TEMPLATE/BUG.yml +++ b/.github/ISSUE_TEMPLATE/BUG.yml @@ -11,7 +11,7 @@ body: If you're looking to file an issue with CPython itself, please click here: [CPython Issues](https://github.com/python/cpython/issues/new/choose). - Issues related to [Python's documentation](https://docs.python.org) can also be filed [here](https://github.com/python/cpython/issues/new?assignees=&labels=docs&template=documentation.md). + Issues related to [Python's documentation](https://docs.python.org) can also be filed [here](https://github.com/python/cpython/issues/new?assignees=&labels=docs&template=documentation.yml). - type: textarea id: description diff --git a/.github/ISSUE_TEMPLATE/DOCS.yml b/.github/ISSUE_TEMPLATE/DOCS.yml index 2f216878a..857bc77a8 100644 --- a/.github/ISSUE_TEMPLATE/DOCS.yml +++ b/.github/ISSUE_TEMPLATE/DOCS.yml @@ -11,7 +11,7 @@ body: If you're looking to file an issue with CPython itself, please click here: [CPython Issues](https://github.com/python/cpython/issues/new/choose). - Issues related to [Python's documentation](https://docs.python.org) can also be filed [here](https://github.com/python/cpython/issues/new?assignees=&labels=docs&template=documentation.md). + Issues related to [Python's documentation](https://docs.python.org) can also be filed [here](https://github.com/python/cpython/issues/new?assignees=&labels=docs&template=documentation.yml). - type: textarea id: summary diff --git a/.github/ISSUE_TEMPLATE/REQUEST.yml b/.github/ISSUE_TEMPLATE/REQUEST.yml index c0f29e2c0..c2dd2363b 100644 --- a/.github/ISSUE_TEMPLATE/REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/REQUEST.yml @@ -11,7 +11,7 @@ body: If you're looking to file an issue with CPython itself, please click here: [CPython Issues](https://github.com/python/cpython/issues/new/choose). - Issues related to [Python's documentation](https://docs.python.org) can also be filed [here](https://github.com/python/cpython/issues/new?assignees=&labels=docs&template=documentation.md). + Issues related to [Python's documentation](https://docs.python.org) can also be filed [here](https://github.com/python/cpython/issues/new?assignees=&labels=docs&template=documentation.yml). - type: textarea id: problem diff --git a/apps/downloads/models.py b/apps/downloads/models.py index e7cfe30f2..bd2b5199f 100644 --- a/apps/downloads/models.py +++ b/apps/downloads/models.py @@ -55,7 +55,7 @@ def __str__(self): def get_absolute_url(self): """Return the URL for this OS's download list page.""" - return reverse("download:download_os_list", kwargs={"os_slug": self.slug}) + return reverse("download:download_os_list", kwargs={"slug": self.slug}) class Release(ContentManageable, NameSlugModel): diff --git a/apps/downloads/tests/test_models.py b/apps/downloads/tests/test_models.py index bdd04d5ef..3b4df7698 100644 --- a/apps/downloads/tests/test_models.py +++ b/apps/downloads/tests/test_models.py @@ -28,6 +28,10 @@ def test_stringification(self): self.assertEqual(str(self.osx), "macOS") self.assertEqual(str(self.release_275), "Python 2.7.5") + def test_os_get_absolute_url(self): + """OS detail URL reverses with the `slug` kwarg.""" + self.assertEqual(self.linux.get_absolute_url(), f"/downloads/{self.linux.slug}/") + def test_published(self): published_releases = Release.objects.published() self.assertEqual(len(published_releases), 7) diff --git a/apps/downloads/tests/test_views.py b/apps/downloads/tests/test_views.py index f7f86129c..edbf82ecc 100644 --- a/apps/downloads/tests/test_views.py +++ b/apps/downloads/tests/test_views.py @@ -143,6 +143,20 @@ def test_latest_prerelease_redirect_when_no_prerelease(self): response = self.client.get(url) self.assertRedirects(response, reverse("download:download")) + def test_latest_python2_redirects_to_downloads_when_no_latest(self): + """Fallback redirect must reverse correctly when no Python 2 is flagged latest.""" + Release.objects.filter(version=Release.PYTHON2).update(is_latest=False) + url = reverse("download:download_latest_python2") + response = self.client.get(url) + self.assertRedirects(response, reverse("download:download")) + + def test_latest_pymanager_redirects_to_downloads_when_no_latest(self): + """No pymanager fixture exists, so this always exercises the fallback.""" + self.assertIsNone(Release.objects.latest_pymanager()) + url = reverse("download:download_latest_pymanager") + response = self.client.get(url) + self.assertRedirects(response, reverse("download:download")) + def test_redirect_page_object_to_release_detail_page(self): self.release_275.release_page = None self.release_275.save() diff --git a/apps/downloads/views.py b/apps/downloads/views.py index 01dd4a33d..b5f532861 100644 --- a/apps/downloads/views.py +++ b/apps/downloads/views.py @@ -29,7 +29,7 @@ def get_redirect_url(self, **kwargs): if latest_python2: return latest_python2.get_absolute_url() - return reverse("download") + return reverse("download:download") class DownloadLatestPython3(RedirectView): @@ -48,7 +48,7 @@ def get_redirect_url(self, **kwargs): if latest_release: return latest_release.get_absolute_url() - return reverse("downloads:download") + return reverse("download:download") class DownloadLatestPrerelease(RedirectView): @@ -65,7 +65,7 @@ def get_redirect_url(self, **kwargs): if latest_prerelease: return latest_prerelease.get_absolute_url() - return reverse("downloads:download") + return reverse("download:download") class DownloadLatestPyManager(RedirectView): @@ -82,7 +82,7 @@ def get_redirect_url(self, **kwargs): if latest_pymanager: return latest_pymanager.get_absolute_url() - return reverse("downloads") + return reverse("download:download") class DownloadBase: @@ -267,7 +267,7 @@ class ReleaseFeed(Feed): @staticmethod def link() -> str: """Return the URL to the main downloads page.""" - return reverse("downloads:download") + return reverse("download:download") def items(self) -> list[dict[str, Any]]: """Return the latest Python releases."""