From: Radek Czajka Date: Tue, 8 Nov 2011 11:12:08 +0000 (+0100) Subject: zip download and fabfile fixes X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/f4c540df2eb34b761e08f67396c22daf3b14ca10?hp=dd549d9f4b46da1b7a42145f571c746f3831953e zip download and fabfile fixes --- 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)