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

Get version from the api #5788

Merged
merged 1 commit into from
Jun 11, 2019
Merged
Changes from all commits
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
11 changes: 6 additions & 5 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,11 +1387,12 @@ def warn(self, msg):

def clean_build(version_pk):
"""Clean the files used in the build of the given version."""
version = Version.objects.get_object_or_log(pk=version_pk)
if (
not version or
not version.project.has_feature(Feature.CLEAN_AFTER_BUILD)
):
try:
version = SyncRepositoryMixin.get_version(version_pk)
Copy link
Member

Choose a reason for hiding this comment

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

A comment about why this is not using get_object_or_log as the rest of the functions here would be good to avoid the same confusion in the future.

except Exception:
log.exception('Error while fetching the version from the api')
return False
if not version.project.has_feature(Feature.CLEAN_AFTER_BUILD):
log.info(
'Skipping build files deletetion for version: %s',
version_pk,
Expand Down