Browse Source

FIX no warning messages when an attribute definition is not set

pull/2/head
Daniel Reis 12 years ago
parent
commit
54d2c64a5f
  1. 6
      users_ldap_mail/users_ldap_model.py

6
users_ldap_mail/users_ldap_model.py

@ -28,9 +28,10 @@ class CompanyLDAP(orm.Model):
_inherit = 'res.company.ldap'
_columns = {
'name_attribute': fields.char('Name Attribute', size=64,
help="Default in 'cn'. For an AD you could use 'displayName' instead."),
help="By default 'cn' is used. "
"For ActiveDirectory you might use 'displayName' instead."),
'mail_attribute': fields.char('E-mail attribute', size=64,
help="Active Directory uses the 'mail' attribute."),
help="LDAP attribute to use to retrieve em-mail address."),
}
_defaults = {
'mail_attribute': 'mail',
@ -63,6 +64,7 @@ class CompanyLDAP(orm.Model):
]
for value_key, conf_name in mapping:
try:
if conf[conf_name]:
values[value_key] = ldap_entry[1][conf[conf_name]][0]
except KeyError:
_log.warning('No LDAP attribute "%s" found for login "%s"' % (

Loading…
Cancel
Save