Skip to content

Commit 1cde2bb

Browse files
ericholscheragjohnson
authored andcommitted
Deploy hotfixes (#2972)
* Don't explode on makedirs * Fix ad lookup * Fix task designation * Handle version handling. This should be a decorator * Upgrade slumber
1 parent 9310343 commit 1cde2bb

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

readthedocs/builds/syncers.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from django.conf import settings
1616

1717
from readthedocs.core.utils.extend import SettingsOverrideObject
18+
from readthedocs.core.utils import safe_makedirs
1819

1920

2021
log = logging.getLogger(__name__)
@@ -127,8 +128,9 @@ def copy(cls, path, target, host, is_file=False, **__):
127128
sync_user = getattr(settings, 'SYNC_USER', getpass.getuser())
128129
if not is_file:
129130
path += "/"
130-
log.info("Local Copy %s to %s", path, target)
131-
os.makedirs(target)
131+
log.info("Remote Pull %s to %s", path, target)
132+
if not is_file and not os.path.exists(target):
133+
safe_makedirs(target)
132134
# Add a slash when copying directories
133135
sync_cmd = "rsync -e 'ssh -T' -av --delete {user}@{host}:{path} {target}".format(
134136
host=host,

readthedocs/donate/signals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def is_gold_project(project):
163163

164164
def is_community_only(user, project):
165165
"""Return True is this project or user should only be shown community ads"""
166-
if user.is_authenticated() and user.profile.as_opt_out:
166+
if user.is_authenticated() and not user.profile.allow_ads:
167167
return True
168168
if not project.allow_promos:
169169
return True

readthedocs/projects/tasks.py

+12
Original file line numberDiff line numberDiff line change
@@ -918,20 +918,32 @@ def clear_artifacts(version_pk):
918918
clear_html_artifacts(version)
919919

920920

921+
@task()
921922
def clear_pdf_artifacts(version):
923+
if isinstance(version, int):
924+
version = Version.objects.get(pk=version)
922925
remove_dir(version.project.get_production_media_path(
923926
type_='pdf', version_slug=version.slug))
924927

925928

929+
@task()
926930
def clear_epub_artifacts(version):
931+
if isinstance(version, int):
932+
version = Version.objects.get(pk=version)
927933
remove_dir(version.project.get_production_media_path(
928934
type_='epub', version_slug=version.slug))
929935

930936

937+
@task()
931938
def clear_htmlzip_artifacts(version):
939+
if isinstance(version, int):
940+
version = Version.objects.get(pk=version)
932941
remove_dir(version.project.get_production_media_path(
933942
type_='htmlzip', version_slug=version.slug))
934943

935944

945+
@task()
936946
def clear_html_artifacts(version):
947+
if isinstance(version, int):
948+
version = Version.objects.get(pk=version)
937949
remove_dir(version.project.rtd_build_path(version=version.slug))

requirements/pip.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ django-vanilla-views==1.0.4
2121
jsonfield==1.0.3
2222

2323
requests==2.3.0
24-
slumber==0.7.0
24+
slumber==0.7.1
2525
lxml==3.3.5
2626

2727
django-countries==3.4.1

0 commit comments

Comments
 (0)