Skip to content

Commit

Permalink
Remove embed API v2 code (#11945)
Browse files Browse the repository at this point in the history
🗑️
  • Loading branch information
stsewd authored Jan 29, 2025
1 parent 03f73a6 commit 6ea4ec6
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 1,379 deletions.
20 changes: 2 additions & 18 deletions readthedocs/api/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import structlog
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.utils.functional import cached_property

from readthedocs.core.unresolver import UnresolverError, unresolve
from readthedocs.core.utils import get_cache_tag
from readthedocs.projects.models import Project
from readthedocs.proxito.cache import add_cache_tags

log = structlog.get_logger(__name__)
Expand Down Expand Up @@ -77,11 +75,6 @@ class EmbedAPIMixin:
to avoid hitting the database multiple times on the same request.
"""

# This class is shared between EmbedAPI v2 and v3.
# In v3, we only support the `url` parameter,
# but in v2 we support `project` and `version` as well.
support_url_parameter_only = False

@cached_property
def unresolved_url(self):
url = self.request.GET.get("url")
Expand All @@ -102,11 +95,7 @@ def _get_project(self):
if self.unresolved_url:
return self.unresolved_url.project

if self.support_url_parameter_only:
raise Http404

project_slug = self.request.GET.get("project")
return get_object_or_404(Project, slug=project_slug)
raise Http404

@functools.lru_cache(maxsize=1)
def _get_version(self):
Expand All @@ -116,9 +105,4 @@ def _get_version(self):
if self.unresolved_url:
return self.unresolved_url.version

if self.support_url_parameter_only:
raise Http404

version_slug = self.request.GET.get("version", "latest")
project = self._get_project()
return get_object_or_404(project.versions.all(), slug=version_slug)
raise Http404
424 changes: 0 additions & 424 deletions readthedocs/embed/tests/data/sphinx/latest/index.html

This file was deleted.

46 changes: 0 additions & 46 deletions readthedocs/embed/tests/data/sphinx/latest/index.json

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions readthedocs/embed/tests/data/sphinx/latest/page-sub-title-one.html

This file was deleted.

15 changes: 0 additions & 15 deletions readthedocs/embed/tests/data/sphinx/latest/page-subsub-title.html

This file was deleted.

95 changes: 0 additions & 95 deletions readthedocs/embed/tests/data/sphinx/latest/page-title-one.html

This file was deleted.

103 changes: 0 additions & 103 deletions readthedocs/embed/tests/data/sphinx/latest/page.html

This file was deleted.

59 changes: 0 additions & 59 deletions readthedocs/embed/tests/data/sphinx/latest/page.json

This file was deleted.

Loading

0 comments on commit 6ea4ec6

Please sign in to comment.