Skip to content

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

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

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions readthedocs/core/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,17 @@ def _get_canonical_project(self, project, projects=None):
# Track what projects have already been traversed to avoid infinite
# 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]
else:
projects.append(project)
projects = projects or set()
projects.add(project)
Copy link
Member

@ericholscher ericholscher Apr 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this logic changed? It feels less clear to me.


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