Fix: Add permanent redirects for legacy sponsorship pages (Issue #2645)#2944
Fix: Add permanent redirects for legacy sponsorship pages (Issue #2645)#2944iampujan wants to merge 5 commits intopython:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes broken legacy sponsorship URLs by adding permanent HTTP 301 redirects to their modern counterparts. The issue (#2645) reported that users clicking on old sponsorship links encountered 404 errors, breaking the sponsorship application workflow.
Changes:
- Added permanent redirects from
/psf/sponsorship-old/to/psf/sponsors/and from/psf/forms/sponsor-application/to/sponsors/application/ - Added test coverage to verify both redirects return HTTP 301 status codes and redirect to the correct URLs
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pydotorg/urls.py | Added two RedirectView entries for legacy sponsorship URLs with permanent=True flag |
| pydotorg/tests/test_views.py | Added test_legacy_sponsor_redirects() method to verify both redirects work correctly |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2adb3f1 to
1e1ea39
Compare
Address Copilot PR feedback: use url patterns and reverse for sponsors redirects
1e1ea39 to
2b3ff57
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # other section landing pages | ||
| path( | ||
| "psf/sponsorship-old/", | ||
| RedirectView.as_view(pattern_name="psf-sponsors", permanent=True), |
There was a problem hiding this comment.
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).
| RedirectView.as_view(pattern_name="psf-sponsors", permanent=True), | |
| RedirectView.as_view(url="/psf/sponsorship/", permanent=True), |
| 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, | ||
| ) |
There was a problem hiding this comment.
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.
Fixes issue #2645 by permanently redirecting the broken /psf/sponsorship-old/ and /psf/forms/sponsor-application/ URLs to their modern counterparts.