Handle version handling.
This should be a decorator
@@ -920,22 +920,30 @@ def clear_artifacts(version_pk):
@task()
def clear_pdf_artifacts(version):
+ if isinstance(version, int):
+ version = Version.objects.get(pk=version)
remove_dir(version.project.get_production_media_path(
type_='pdf', version_slug=version.slug))
@task()
def clear_epub_artifacts(version):
+ if isinstance(version, int):
+ version = Version.objects.get(pk=version)
remove_dir(version.project.get_production_media_path(
type_='epub', version_slug=version.slug))
@task()
def clear_htmlzip_artifacts(version):
+ if isinstance(version, int):
+ version = Version.objects.get(pk=version)
remove_dir(version.project.get_production_media_path(
type_='htmlzip', version_slug=version.slug))
@task()
def clear_html_artifacts(version):
+ if isinstance(version, int):
+ version = Version.objects.get(pk=version)
remove_dir(version.project.rtd_build_path(version=version.slug))
