Skip to content

Commit

Permalink
[IMP] Protect import of external lib to prevent error when the module…
Browse files Browse the repository at this point in the history
… is put in an addons path without the external lib installed

This error should never occur since if you put this project into your addon path you want to use it and without the lib it don't work. But Travis CI fails if these imports are not protected due to a stupid rule enforced in odoo-pylint (Oct, 11, 2016) OCA/maintainer-quality-tools#354
  • Loading branch information
lmignon committed Jan 5, 2017
1 parent c945567 commit 276f5a0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmis/models/cmis_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import logging
import cmislib.exceptions
from cmislib.model import CmisClient
from cmislib.browser.binding import BrowserBinding
from cmislib.exceptions import ObjectNotFoundException

from openerp import api, fields, models
from openerp.exceptions import UserError
Expand All @@ -16,6 +12,14 @@

_logger = logging.getLogger(__name__)

try:
import cmislib.exceptions
from cmislib.model import CmisClient
from cmislib.browser.binding import BrowserBinding
from cmislib.exceptions import ObjectNotFoundException
except (ImportError, IOError) as err:
_logger.debug(err)


class CmisBackend(models.Model):
_name = 'cmis.backend'
Expand Down

0 comments on commit 276f5a0

Please sign in to comment.