From f4c540df2eb34b761e08f67396c22daf3b14ca10 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 8 Nov 2011 12:12:08 +0100 Subject: [PATCH 1/1] zip download and fabfile fixes --- apps/catalogue/models.py | 1 + apps/catalogue/views.py | 8 ++------ fabfile.py | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index a0f737f58..d90299611 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -615,6 +615,7 @@ class Book(models.Model): for b in books] result = create_zip.delay(paths, getattr(settings, "ALL_%s_ZIP" % format_.upper())) + return result.wait() def zip_audiobooks(self): bm = BookMedia.objects.filter(book=self, type='mp3') diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 9168099ca..64aada533 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -781,12 +781,8 @@ def tag_info(request, id): def download_zip(request, format, slug): url = None - if format == 'pdf': - url = models.Book.zip_pdf() - elif format == 'epub': - url = models.Book.zip_epub() - elif format == 'mobi': - url = models.Book.zip_mobi() + if format in ('pdf', 'epub', 'mobi'): + url = models.Book.zip_format(format) elif format == 'audiobook' and slug is not None: book = models.Book.objects.get(slug=slug) url = book.zip_audiobooks() diff --git a/fabfile.py b/fabfile.py index 764b9c3b4..8ad5f50a5 100644 --- a/fabfile.py +++ b/fabfile.py @@ -165,4 +165,4 @@ def restart_webserver(): print '>>> restart webserver' run('touch %(path)s/%(project_name)s.wsgi' % env) print '>>> restart Celery' - sudo('supervisorctl restart celery.%(project_name)s' % env) + sudo('supervisorctl restart celery.%(project_name)s:' % env) -- 2.20.1