Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't do extra query if the project is a translation #6865

Merged
merged 2 commits into from Apr 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions readthedocs/core/resolver.py
Expand Up @@ -219,16 +219,18 @@ def _get_canonical_project(self, project, projects=None):
# recursion. We can't determine a root project well here, so you get
# what you get if you have configured your project in a strange manner
if projects is None:
projects = [project]
projects = {project}
else:
projects.append(project)
projects.add(project)

next_project = None
relation = project.get_parent_relationship()
if project.main_language_project:
next_project = project.main_language_project
elif relation:
next_project = relation.parent
else:
relation = project.get_parent_relationship()
if relation:
next_project = relation.parent

if next_project and next_project not in projects:
return self._get_canonical_project(next_project, projects)
return project
Expand Down