Skip to content
Open
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
18 changes: 18 additions & 0 deletions pydotorg/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,21 @@ def test_download_index(self):
self.assertContains(response, "Browse Python 3.6.0 Documentation")
self.assertContains(response, "https://docs.python.org/3/whatsnew/3.6.html")
self.assertContains(response, "What's new in Python 3.6")

def test_legacy_sponsor_redirects(self):
"""Test that old sponsorship pages correctly redirect to modern active ones."""
response = self.client.get("/psf/sponsorship-old/")
self.assertRedirects(
response,
reverse("psf-sponsors"),
status_code=301,
fetch_redirect_response=False,
)
Comment on lines +38 to +46
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected redirect target for /psf/sponsorship-old/ is asserted as reverse('psf-sponsors'). If the legacy redirect destination changes (e.g., to /psf/sponsorship/), this test needs to be updated to assert against the same canonical target to avoid locking in the wrong behavior.

Copilot uses AI. Check for mistakes.

response = self.client.get("/psf/forms/sponsor-application/")
self.assertRedirects(
response,
reverse("new_sponsorship_application"),
status_code=301,
fetch_redirect_response=False,
)
10 changes: 9 additions & 1 deletion pydotorg/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import include, path, re_path
from django.views.generic.base import TemplateView
from django.views.generic.base import RedirectView, TemplateView

from apps.cms.views import custom_404
from apps.downloads.views import ReleaseEditButton
Expand Down Expand Up @@ -35,6 +35,14 @@
path("blogs/", include("apps.blogs.urls")),
path("inner/", TemplateView.as_view(template_name="python/inner.html"), name="inner"),
# other section landing pages
path(
"psf/sponsorship-old/",
RedirectView.as_view(pattern_name="psf-sponsors", permanent=True),
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The legacy /psf/sponsorship-old/ URL is being redirected to the PSF sponsors list (psf-sponsors => /psf/sponsors/), but the site’s navigation and templates consistently treat /psf/sponsorship/ as the canonical sponsorship landing page (e.g., PSF index and sponsors list link to /psf/sponsorship/). Redirecting to /psf/sponsors/ is unlikely to be the intended “modern counterpart” and may not resolve the missing prospectus content from the old page. Consider redirecting /psf/sponsorship-old/ directly to /psf/sponsorship/ (using a fixed url= redirect since it’s not a named URLpattern).

Suggested change
RedirectView.as_view(pattern_name="psf-sponsors", permanent=True),
RedirectView.as_view(url="/psf/sponsorship/", permanent=True),

Copilot uses AI. Check for mistakes.
),
path(
"psf/forms/sponsor-application/",
RedirectView.as_view(pattern_name="new_sponsorship_application", permanent=True),
),
path("psf-landing/", TemplateView.as_view(template_name="psf/index.html"), name="psf-landing"),
path("psf/sponsors/", TemplateView.as_view(template_name="psf/sponsors-list.html"), name="psf-sponsors"),
path("docs-landing/", TemplateView.as_view(template_name="docs/index.html"), name="docs-landing"),
Expand Down
Loading