Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/DOCS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/REQUEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/downloads/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions apps/downloads/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions apps/downloads/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions apps/downloads/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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:
Expand Down Expand Up @@ -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."""
Expand Down