From 183dea151100925e11d3ea0ebe8a315310060e93 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 30 Apr 2014 15:17:10 -0400 Subject: [PATCH] patch the personalizer --- core/epub.py | 8 ++++---- core/models.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/epub.py b/core/epub.py index 4ba5fe5b..52cd3ad4 100644 --- a/core/epub.py +++ b/core/epub.py @@ -12,9 +12,10 @@ def personalize(epub_file, acq): part = StringIO(unicode(render_to_string('epub/datedcc_license.xhtml', context))) output.addpart(part, "datedcc_license.xhtml", "application/xhtml+xml", 1) #after title, we hope output.addmetadata('rights','%s after %s'%(acq.work.last_campaign().license_url,acq.work.last_campaign().cc_date)) - output.close() - #output.writetodisk('testfile2.epub') - return output + personalized_epub= StringIO() + output.writetodisk(personalized_epub) + #logger.info("personalized") + return personalized_epub def ungluify(epub_file, campaign): @@ -24,7 +25,6 @@ def ungluify(epub_file, campaign): output.addpart(part, "cc_license.xhtml", "application/xhtml+xml", 1) #after title, we hope output.addmetadata('rights', campaign.license_url) output.close() - #output.writetodisk('testfile3.epub') return output from regluit.booxtream import BooXtream diff --git a/core/models.py b/core/models.py index fe0b9bf9..7e12c693 100755 --- a/core/models.py +++ b/core/models.py @@ -340,15 +340,15 @@ class Acq(models.Model): 'expirydays': 1, 'downloadlimit': 7, 'exlibris':0, - 'chapterfooter': 1 if do_watermark else 0, + 'chapterfooter': 0, 'disclaimer':0, 'referenceid': '%s:%s:%s' % (self.work.id, self.user.id, self.id) if do_watermark else 'N/A', 'kf8mobi': True, 'epub': True, } personalized = personalize(self.work.epubfiles()[0].file, self) - personalized.filename.seek(0) - self.watermarked = watermarker.platform(epubfile= personalized.filename, **params) + personalized.seek(0) + self.watermarked = watermarker.platform(epubfile= personalized, **params) self.save() return self.watermarked