summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-12-06 17:27:11 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-12-06 17:27:11 +0000
commit56a66d16532896d9b93be9fe0806a8b18a7c2bda (patch)
treeafe1a4f24108f91ad085408abe03ca78eecd9eb7
parentbdd6e6a28d45bb909aa75140a1bd6316556f7903 (diff)
downloadpykolab-56a66d16532896d9b93be9fe0806a8b18a7c2bda.tar.gz
Update obtaining the preferred language for a user
-rw-r--r--pykolab/auth/ldap/__init__.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 0d88981..876d29e 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1020,15 +1020,18 @@ class LDAP(object):
user = utils.normalize(user)
_get_attrs = []
-
- for attribute in [
+ _wanted_attributes = [
result_attribute,
+ 'mail',
+ 'mailalternateaddress',
'sn',
'givenname',
'cn',
'uid',
'preferredLanguage'
- ]:
+ ]
+
+ for attribute in_wanted_attributes:
if not user.has_key(attribute):
_get_attrs.append(attribute)
#user[attribute] = self._get_user_attribute(user, attribute)
@@ -1038,13 +1041,16 @@ class LDAP(object):
for key in _user_attrs.keys():
user[key] = _user_attrs[key]
- if user['preferredLanguage'] == None:
+ user = utils.normalize(user)
+
+ if not user.has_key('preferredlanguage') or user['preferredlanguage'] == None:
if conf.has_option(primary_domain, 'default_locale'):
default_locale = conf.get(primary_domain, 'default_locale')
else:
default_locale = conf.get('kolab','default_locale')
- self._set_user_attribute(user, 'preferredLanguage', default_locale)
+ self._set_user_attribute(user, 'preferredlanguage', default_locale)
+ user['preferredlanguage'] = default_locale
# Check to see if we want to apply a primary mail recipient policy
if conf.has_option(primary_domain, 'primary_mail'):