Browse Source

Merge pull request #232 from pedrobaeza/8.0-import_ldap_fix

[FIX] users_ldap_populate: Protect ldap library import
pull/272/head
Nhomar Hernández [Vauxoo] 9 years ago
parent
commit
603ceb8c5c
  1. 3
      users_ldap_populate/__openerp__.py
  2. 8
      users_ldap_populate/model/users_ldap.py

3
users_ldap_populate/__openerp__.py

@ -41,6 +41,9 @@ object you want to query.
"depends": [ "depends": [
'auth_ldap', 'auth_ldap',
], ],
'external_dependencies': {
'python': ['ldap'],
},
"data": [ "data": [
'view/users_ldap.xml', 'view/users_ldap.xml',
'view/populate_wizard.xml', 'view/populate_wizard.xml',

8
users_ldap_populate/model/users_ldap.py

@ -20,10 +20,16 @@
############################################################################## ##############################################################################
import re import re
from ldap.filter import filter_format
from openerp.osv import orm from openerp.osv import orm
import logging import logging
_logger = logging.getLogger(__name__)
try:
from ldap.filter import filter_format
except ImportError:
_logger.debug('Can not `from ldap.filter import filter_format`.')
class CompanyLDAP(orm.Model): class CompanyLDAP(orm.Model):
_inherit = 'res.company.ldap' _inherit = 'res.company.ldap'

Loading…
Cancel
Save