zip download and fabfile fixes
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 8 Nov 2011 11:12:08 +0000 (12:12 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 8 Nov 2011 11:12:08 +0000 (12:12 +0100)
apps/catalogue/models.py
apps/catalogue/views.py
fabfile.py

index a0f737f..d902996 100644 (file)
@@ -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')
index 9168099..64aada5 100644 (file)
@@ -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()
index 764b9c3..8ad5f50 100644 (file)
@@ -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)