Skip to content

Commit

Permalink
Unresolver: remove old language code compatibility (#10869)
Browse files Browse the repository at this point in the history
All projects are migrated now, we don't need this.
  • Loading branch information
stsewd authored Oct 25, 2023
1 parent f9384df commit f75e4de
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions readthedocs/core/unresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,15 @@ def _match_multiversion_project(

language = match.group("language")
# Normalize old language codes to lowercase with dashes.
normalized_language = language.lower().replace("_", "-")

# TODO: remove after deploy.
# This is so we can temporarily support old language codes
# while we migrate existing projects.
languages = [language, normalized_language]
language = language.lower().replace("_", "-")

version_slug = match.group("version")
filename = self._normalize_filename(match.group("filename"))

if parent_project.language in languages:
if parent_project.language == language:
project = parent_project
else:
project = parent_project.translations.filter(language__in=languages).first()
project = parent_project.translations.filter(language=language).first()
if not project:
raise TranslationNotFoundError(
project=parent_project,
Expand Down

0 comments on commit f75e4de

Please sign in to comment.