From: Marcin Koziej Date: Mon, 12 Dec 2011 08:18:49 +0000 (+0100) Subject: merge new librarian changes with custom pdf fix X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/b9bf77dc8f2d4b1b64bd7a29730bec3e3f885a6e?hp=7e6d14043e3e2dce8e3fdcef0b0fc649680b07b3 merge new librarian changes with custom pdf fix --- diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 2ca78b01e..afc241ddd 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -202,8 +202,10 @@ def get_customized_pdf_path(book, customizations): """ customizations.sort() h = hash(tuple(customizations)) + pdf_name = '%s-custom-%s' % (book.fileid(), h) - pdf_file = models.get_dynamic_path(None, pdf_name, ext='pdf') + pdf_file = get_dynamic_path(None, pdf_name, ext='pdf') + return pdf_file @@ -565,16 +567,17 @@ class Book(models.Model): current_self.pdf_file.save('%s.pdf' % self.fileid(), File(open(pdf.get_filename()))) self.pdf_file = current_self.pdf_file + + # remove cached downloadables + remove_zip(settings.ALL_PDF_ZIP) + + for customized_pdf in get_existing_customized_pdf(self): + unlink(customized_pdf) else: print "saving %s" % file_name print "to: %s" % DefaultStorage().path(file_name) DefaultStorage().save(file_name, File(open(pdf.get_filename()))) - # remove cached downloadables - remove_zip(settings.ALL_PDF_ZIP) - for customized_pdf in get_existing_customized_pdf(self): - unlink(customized_pdf) - def build_mobi(self): """ (Re)builds the MOBI file.