patch the personalizer

pull/1/head
eric 2014-04-30 15:17:10 -04:00
parent 0b4d670226
commit 183dea1511
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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