Improve Python3 support in get_facturx_xml_from_pdf()

Fix the meaning of an error message
This commit is contained in:
Alexis de Lattre 2020-02-11 22:53:02 +01:00 committed by Nicolas ROCHE
parent d19d4ce939
commit 9198ce07d9
3 changed files with 7 additions and 3 deletions

View File

@ -86,6 +86,10 @@ Contributors
Changelog
=========
* Version 1.9 dated 2020-02-11
* Improve Python3 support in get_facturx_xml_from_pdf()
* Version 1.8 dated 2020-01-16
* New tool facturx-webservice which implements a REST webservice using Flask to generate a Factur-X PDF invoice via a simple POST request.

View File

@ -1 +1 @@
__version__ = '1.8'
__version__ = '1.9'

View File

@ -245,8 +245,8 @@ def get_facturx_xml_from_pdf(pdf_invoice, check_xsd=True):
if not pdf_invoice:
raise ValueError('Missing pdf_invoice argument')
if not isinstance(check_xsd, bool):
raise ValueError('Missing pdf_invoice argument')
if isinstance(pdf_invoice, str):
raise ValueError('Bad type for check_xsd argument')
if isinstance(pdf_invoice, (str, bytes)):
pdf_file = BytesIO(pdf_invoice)
elif isinstance(pdf_invoice, file):
pdf_file = pdf_invoice