Skip to content

Commit 1e1ea39

Browse files
committed
Fix #2645: Add permanent redirects for legacy sponsorship pages
Address Copilot PR feedback: use url patterns and reverse for sponsors redirects
1 parent a850eb5 commit 1e1ea39

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

infra/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module "fastly_production" {
55
domain = "python.org"
66
subdomain = "www.python.org"
77
extra_domains = ["www.python.org"]
8-
backend_address = "pythondotorg.ingress.us-east-2.psfhosted.computer"
8+
backend_address = "psf-pythondotorg-pythondotorg-b0dbd19e-web.psfhosted.net"
99
default_ttl = 3600
1010

1111
datadog_key = var.DATADOG_API_KEY
@@ -27,7 +27,7 @@ module "fastly_staging" {
2727
subdomain = "www.test.python.org"
2828
extra_domains = ["www.test.python.org"]
2929
# TODO: adjust to test-pythondotorg when done testing NGWAF
30-
backend_address = "pythondotorg.ingress.us-east-2.psfhosted.computer"
30+
backend_address = "psf-pythondotorg-pythondotorg-b0dbd19e-web.psfhosted.net"
3131
default_ttl = 3600
3232

3333
datadog_key = var.DATADOG_API_KEY

pydotorg/tests/test_views.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ def test_download_index(self):
3838
def test_legacy_sponsor_redirects(self):
3939
"""Test that old sponsorship pages correctly redirect to modern active ones."""
4040
response = self.client.get("/psf/sponsorship-old/")
41-
self.assertRedirects(response, "/psf/sponsors/", status_code=301)
41+
self.assertRedirects(
42+
response,
43+
reverse("psf-sponsors"),
44+
status_code=301,
45+
fetch_redirect_response=False,
46+
)
4247

4348
response = self.client.get("/psf/forms/sponsor-application/")
44-
self.assertRedirects(response, "/sponsors/application/", status_code=301)
49+
self.assertRedirects(
50+
response,
51+
reverse("new_sponsorship_application"),
52+
status_code=301,
53+
fetch_redirect_response=False,
54+
)

pydotorg/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
# other section landing pages
3838
path(
3939
"psf/sponsorship-old/",
40-
RedirectView.as_view(url="/psf/sponsors/", permanent=True),
40+
RedirectView.as_view(pattern_name="psf-sponsors", permanent=True),
4141
),
4242
path(
4343
"psf/forms/sponsor-application/",
44-
RedirectView.as_view(url="/sponsors/application/", permanent=True),
44+
RedirectView.as_view(pattern_name="new_sponsorship_application", permanent=True),
4545
),
4646
path("psf-landing/", TemplateView.as_view(template_name="psf/index.html"), name="psf-landing"),
4747
path("psf/sponsors/", TemplateView.as_view(template_name="psf/sponsors-list.html"), name="psf-sponsors"),

0 commit comments

Comments
 (0)