From 412c90389e8f5db9bf71eab3ec6a11a7297999c2 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Thu, 3 Jun 2010 13:37:24 +0000 Subject: [PATCH] Use standard API to access content information. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35953 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/PDFDocument.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/product/ERP5/Document/PDFDocument.py b/product/ERP5/Document/PDFDocument.py index 2d3130aaa5..eaa41963ff 100644 --- a/product/ERP5/Document/PDFDocument.py +++ b/product/ERP5/Document/PDFDocument.py @@ -106,10 +106,10 @@ class PDFDocument(Image): """ Convert the PDF text content to text with pdftotext """ - if not self.data: + if not self.hasData(): return '' tmp = tempfile.NamedTemporaryFile() - tmp.write(str(self.getData())) + tmp.write(self.getData()) tmp.seek(0) command_result = Popen(['pdftotext', '-layout', '-enc', 'UTF-8', '-nopgbrk', tmp.name, '-'], @@ -170,10 +170,10 @@ class PDFDocument(Image): NOTE: XXX check that command exists and was executed successfully """ - if not self.data: + if not self.hasData(): return '' tmp = tempfile.NamedTemporaryFile() - tmp.write(str(self.data)) + tmp.write(self.getData()) tmp.seek(0) command_result = Popen(['pdftohtml', '-enc', 'UTF-8', '-stdout', '-noframes', '-i', tmp.name], stdout=PIPE)\ @@ -202,7 +202,7 @@ class PDFDocument(Image): except AttributeError: pass tmp = tempfile.NamedTemporaryFile() - tmp.write(str(self.data)) + tmp.write(self.getData()) tmp.seek(0) try: # First, we use pdfinfo to get standard metadata -- 2.30.9