Commit ee9e6920 authored by Sebastien Robin's avatar Sebastien Robin

make OOoTemplate working with the new API of OOoDocument and Document

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13785 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 82e29250
...@@ -511,21 +511,21 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0"> ...@@ -511,21 +511,21 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0">
# now create a temp OOoDocument to convert data to pdf # now create a temp OOoDocument to convert data to pdf
from Products.ERP5Type.Document import newTempOOoDocument from Products.ERP5Type.Document import newTempOOoDocument
tmp_ooo = newTempOOoDocument(self, self.title_or_id()) tmp_ooo = newTempOOoDocument(self, self.title_or_id())
tmp_ooo.edit(data = ooo, tmp_ooo.edit(base_data = ooo,
fname = self.title_or_id(), fname = self.title_or_id(),
source_reference = self.title_or_id(), source_reference = self.title_or_id(),
content_type = self.content_type,) base_content_type = self.content_type,)
tmp_ooo.oo_data = ooo tmp_ooo.oo_data = ooo
if format == 'pdf': if format == 'pdf':
# slightly different implementation # slightly different implementation
# now convert it to pdf # now convert it to pdf
tgts=[x[1] for x in tmp_ooo.getTargetFormatItemList() if x[1].endswith('pdf')] tgts=[x[1] for x in tmp_ooo.getTargetFormatItemList() if x[1].endswith('pdf')]
if len(tgts)>1: if len(tgts)>1:
return tmp_ooo.returnMessage('multiple pdf formats found - this shouldnt happen') raise ValueError, 'multiple pdf formats found - this shouldnt happen'
if len(tgts)==0: if len(tgts)==0:
return tmp_ooo.returnMessage('no pdf format found') raise ValueError, 'no pdf format found'
fmt=tgts[0] fmt=tgts[0]
mime, data = tmp_ooo._makeFile(fmt) mime, data = tmp_ooo.convert(fmt)
if REQUEST is not None: if REQUEST is not None:
REQUEST.RESPONSE.setHeader('Content-type', 'application/pdf') REQUEST.RESPONSE.setHeader('Content-type', 'application/pdf')
REQUEST.RESPONSE.setHeader('Content-disposition', 'attachment;; filename="%s.pdf"' % self.title_or_id()) REQUEST.RESPONSE.setHeader('Content-disposition', 'attachment;; filename="%s.pdf"' % self.title_or_id())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment