[IMP] Soft fail on missing cups import

cups is an external dependency, if it is not installed Odoo will not start.
OCA guidelines specify guidelines for External dependencies, code is from there.
This commit is contained in:
Roel Adriaans
2015-12-10 12:29:02 +01:00
committed by Graeme Gellatly
parent 25714fdb53
commit aae69f9d95
2 changed files with 16 additions and 5 deletions

View File

@@ -21,13 +21,18 @@
#
##############################################################################
import cups
import logging
_logger = logging.getLogger(__name__)
try:
import cups
except ImportError:
_logger.debug('Cannot `import cups`.')
from openerp.exceptions import Warning
from openerp import models, api, _
from openerp.tools.config import config
import logging
_logger = logging.getLogger(__name__)
CUPS_HOST = config.get('cups_host', 'localhost')
CUPS_PORT = int(config.get('cups_port', 631))