Skip to content

Commit d41a12a

Browse files
committed
Fix #2645: Add permanent redirects for legacy sponsorship pages
1 parent a18368a commit d41a12a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

pydotorg/tests/test_views.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ def test_download_index(self):
3434
self.assertContains(response, "Browse Python 3.6.0 Documentation")
3535
self.assertContains(response, "https://docs.python.org/3/whatsnew/3.6.html")
3636
self.assertContains(response, "What's new in Python 3.6")
37+
38+
def test_legacy_sponsor_redirects(self):
39+
"""Test that old sponsorship pages correctly redirect to modern active ones."""
40+
response = self.client.get("/psf/sponsorship-old/")
41+
self.assertRedirects(response, "/psf/sponsors/", status_code=301)
42+
43+
response = self.client.get("/psf/forms/sponsor-application/")
44+
self.assertRedirects(response, "/sponsors/application/", status_code=301)

pydotorg/urls.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.contrib import admin
66
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
77
from django.urls import include, path, re_path
8-
from django.views.generic.base import TemplateView
8+
from django.views.generic.base import RedirectView, TemplateView
99

1010
from apps.cms.views import custom_404
1111
from apps.downloads.views import ReleaseEditButton
@@ -35,6 +35,14 @@
3535
path("blogs/", include("apps.blogs.urls")),
3636
path("inner/", TemplateView.as_view(template_name="python/inner.html"), name="inner"),
3737
# other section landing pages
38+
path(
39+
"psf/sponsorship-old/",
40+
RedirectView.as_view(url="/psf/sponsors/", permanent=True),
41+
),
42+
path(
43+
"psf/forms/sponsor-application/",
44+
RedirectView.as_view(url="/sponsors/application/", permanent=True),
45+
),
3846
path("psf-landing/", TemplateView.as_view(template_name="psf/index.html"), name="psf-landing"),
3947
path("psf/sponsors/", TemplateView.as_view(template_name="psf/sponsors-list.html"), name="psf-sponsors"),
4048
path("docs-landing/", TemplateView.as_view(template_name="docs/index.html"), name="docs-landing"),

0 commit comments

Comments
 (0)