Skip to content

Commit 09ae249

Browse files
authored
Merge branch 'master' into humitos/pulling-cache-status
2 parents d463e3d + 8f9cb19 commit 09ae249

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

readthedocs/projects/tasks.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,9 @@ def pull_cached_environment(self, environment):
123123
'msg': msg,
124124
}
125125
)
126-
_, tmp_filename = tempfile.mkstemp(suffix='.tar')
127126
remote_fd = storage.open(filename, mode='rb')
128-
with open(tmp_filename, mode='wb') as local_fd:
129-
local_fd.write(remote_fd.read())
130-
131-
with tarfile.open(tmp_filename) as tar:
132-
tar.extractall(self.version.project.doc_path)
133-
134-
# Cleanup the temporary file
135-
if os.path.exists(tmp_filename):
136-
os.remove(tmp_filename)
127+
with tarfile.open(fileobj=remote_fd) as tar:
128+
tar.extractall(self.project.doc_path)
137129

138130
def push_cached_environment(self, environment):
139131
if not self.project.has_feature(feature_id=Feature.CACHED_ENVIRONMENT):

readthedocs/proxito/views/serve.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ def get(self, request, proxito_path, template_name='404.html'):
261261
# If that doesn't work, attempt to serve the 404 of the current version (version_slug)
262262
# Secondly, try to serve the 404 page for the default version
263263
# (project.get_default_version())
264-
for version_slug_404 in set([version_slug, final_project.get_default_version()]):
264+
versions = [version_slug]
265+
default_version_slug = final_project.get_default_version()
266+
if default_version_slug != version_slug:
267+
versions.append(default_version_slug)
268+
for version_slug_404 in versions:
265269
for tryfile in ('404.html', '404/index.html'):
266270
storage_root_path = final_project.get_storage_path(
267271
type_='html',

0 commit comments

Comments
 (0)