[Erp5-report] r35953 nicolas - /erp5/trunk/products/ERP5/Document/PDFDocument.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jun 3 15:37:26 CEST 2010


Author: nicolas
Date: Thu Jun  3 15:37:24 2010
New Revision: 35953

URL: http://svn.erp5.org?rev=35953&view=rev
Log:
Use standard API to access content information.

Modified:
    erp5/trunk/products/ERP5/Document/PDFDocument.py

Modified: erp5/trunk/products/ERP5/Document/PDFDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PDFDocument.py?rev=35953&r1=35952&r2=35953&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PDFDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/PDFDocument.py [utf8] Thu Jun  3 15:37:24 2010
@@ -106,10 +106,10 @@
     """
       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 @@
     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 @@
     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




More information about the Erp5-report mailing list