Skip to content

Commit 466bf2f

Browse files
Alexis de Lattregbrito
Alexis de Lattre
authored andcommitted
8.0 Use try/except when importing external libs (#8)
[FIX] LINT Use try/except when importing external libs Remove self.ensure_one() that has nothing to do in an api.model method
1 parent 872476f commit 466bf2f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

base_business_document_import/models/business_document_import.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
from openerp import models, api, _
66
from openerp.tools import float_compare
77
from openerp.exceptions import Warning as UserError
8-
import PyPDF2
98
from lxml import etree
109
from StringIO import StringIO
1110
import mimetypes
1211
from urlparse import urlparse
1312
import logging
14-
1513
logger = logging.getLogger(__name__)
1614

15+
try:
16+
import PyPDF2
17+
except ImportError:
18+
logger.debug('Cannot import PyPDF2')
19+
1720

1821
class BusinessDocumentImport(models.AbstractModel):
1922
_name = 'business.document.import'

0 commit comments

Comments
 (0)