From d2593a822a112e29c317ac03bb1e10e722b0daff Mon Sep 17 00:00:00 2001 From: nagasrisai <59650078+nagasrisai@users.noreply.github.com> Date: Wed, 18 Mar 2026 17:40:49 +0530 Subject: [PATCH 1/3] fix: remap dead hg.python.org release-notes URLs to GitHub Adds a corrected_release_notes_url property to the Release model that converts old Mercurial-hosted URLs (hg.python.org, now unreachable) to their equivalent paths on GitHub, so legacy release pages still have working changelog links. Closes #2865 --- apps/downloads/models.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/apps/downloads/models.py b/apps/downloads/models.py index 8af0a1c1d..c3dc00d52 100644 --- a/apps/downloads/models.py +++ b/apps/downloads/models.py @@ -114,6 +114,29 @@ def get_absolute_url(self): return self.release_page.get_absolute_url() return reverse("download:download_release_detail", kwargs={"release_slug": self.slug}) + @property + def corrected_release_notes_url(self): + """Return the release notes URL, converting dead hg.python.org links to GitHub. + + Old Mercurial-hosted URLs (hg.python.org) are no longer reachable. + This property remaps them to their equivalent paths on GitHub so that + the "Release notes" links on the downloads page still work for legacy + releases (3.3.6 and earlier). + + Example:: + + http://hg.python.org/cpython/file/v3.3.6/Misc/NEWS + → https://github.com/python/cpython/blob/v3.3.6/Misc/NEWS + """ + url = self.release_notes_url + if not url: + return url + match = re.match(r"https?://hg\.python\.org/cpython/file/([^/]+)/(.+)", url) + if match: + tag, path = match.group(1), match.group(2) + return f"https://github.com/python/cpython/blob/{tag}/{path}" + return url + def download_file_for_os(self, os_slug): """Given an OS slug return the appropriate download file.""" try: @@ -430,3 +453,4 @@ class Meta: violation_error_message="All file URLs must begin with 'https://www.python.org/'", ), ] + From 4830b9ce34d7a692ea8e4bc2dd9851f7667911ef Mon Sep 17 00:00:00 2001 From: nagasrisai <59650078+nagasrisai@users.noreply.github.com> Date: Wed, 18 Mar 2026 17:40:59 +0530 Subject: [PATCH 2/3] fix(template): use corrected_release_notes_url on downloads index Use the new corrected_release_notes_url property so that legacy hg.python.org links are converted to GitHub URLs before rendering. Also guard the anchor so it degrades gracefully when the URL is empty. --- apps/downloads/templates/downloads/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/downloads/templates/downloads/index.html b/apps/downloads/templates/downloads/index.html index d87b32823..1c04f5df0 100644 --- a/apps/downloads/templates/downloads/index.html +++ b/apps/downloads/templates/downloads/index.html @@ -76,7 +76,7 @@