diff options
| author | xmo-odoo <xmo@odoo.com> | 2017-05-12 13:28:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-12 13:28:57 +0200 |
| commit | 021de21e8cdcf35276c945d8070d04435fa1a19c (patch) | |
| tree | 31ef4648e367fa6b5bc54d97f4aa1774a7deaf88 | |
| parent | 13ee5596c6dd32b3471ce705b62b54ea59c00431 (diff) | |
[FIX] P3: replace PyPDF by PyPDF2
PyPDF is unmaintained and abandoned (as noted on its home page
http://pybrary.net/pyPdf/) and was never updated to Python 3. PyPDF2 is
a fork which provides a mostly compatible API and is P3-compatible.
Replace PyPDF by PyPDF2.
| -rw-r--r-- | addons/document/models/ir_attachment.py | 4 | ||||
| -rw-r--r-- | odoo/addons/base/ir/ir_actions_report.py | 4 | ||||
| -rw-r--r-- | requirements.txt | 2 | ||||
| -rw-r--r-- | setup.py | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/addons/document/models/ir_attachment.py b/addons/document/models/ir_attachment.py index 7480a657ff6..53ae1f1f463 100644 --- a/addons/document/models/ir_attachment.py +++ b/addons/document/models/ir_attachment.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import logging -import pyPdf +import PyPDF2 import xml.dom.minidom import zipfile @@ -110,7 +110,7 @@ class IrAttachment(models.Model): if bin_data.startswith('%PDF-'): f = StringIO(bin_data) try: - pdf = pyPdf.PdfFileReader(f) + pdf = PyPDF2.PdfFileReader(f, overwriteWarnings=False) for page in pdf.pages: buf += page.extractText() except Exception: diff --git a/odoo/addons/base/ir/ir_actions_report.py b/odoo/addons/base/ir/ir_actions_report.py index 466f4960300..192cdad6e4d 100644 --- a/odoo/addons/base/ir/ir_actions_report.py +++ b/odoo/addons/base/ir/ir_actions_report.py @@ -19,7 +19,7 @@ import re from collections import namedtuple from contextlib import closing -from pyPdf import PdfFileWriter, PdfFileReader +from PyPDF2 import PdfFileWriter, PdfFileReader from distutils.version import LooseVersion from reportlab.graphics.barcode import createBarcodeDrawing @@ -84,7 +84,7 @@ def _merge_pdf(documents): for document in documents: pdfreport = open(document, 'rb') streams.append(pdfreport) - reader = PdfFileReader(pdfreport) + reader = PdfFileReader(pdfreport, overwriteWarnings=False) for page in range(0, reader.getNumPages()): writer.addPage(reader.getPage(page)) diff --git a/requirements.txt b/requirements.txt index 23abdb04f19..f0696276978 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ psycopg2==2.6.2 pydot==1.2.3 pyldap==2.4.28 pyparsing==2.1.10 -pyPdf==1.13 +PyPDF2==1.26.0 pyserial==3.1.1 python-dateutil==2.5.3 python-openid==2.2.5 @@ -94,7 +94,7 @@ def py2exe_options(): 'pychart', 'pydot', 'pyparsing', - 'pyPdf', + 'PyPDF2', 'pytz', 'reportlab', 'requests', @@ -153,7 +153,7 @@ setup( 'pydot', 'pyldap', # optional 'pyparsing', - 'pypdf', + 'pypdf2', 'pyserial', 'python-dateutil', 'python-openid', |
