summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-12 13:08:50 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-12 13:09:33 +0100
commit58050404ca8c9fadc4cd30be00e848a490791895 (patch)
tree43e7a8cca80744a96925c5685c8b7727285be910 /pykolab
parent75fc437a35647c3945999e3781b7aca991766e7c (diff)
downloadpykolab-58050404ca8c9fadc4cd30be00e848a490791895.tar.gz
Search for or fallback to the default_locale for the user's preferredlanguage attribute. (#839)
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/plugins/recipientpolicy/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py
index ab72980..1c97857 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -61,6 +61,15 @@ class KolabRecipientpolicy(object):
elif not user_attrs['domain'] == kw['primary_domain']:
user_attrs['domain'] = kw['primary_domain']
+ if not user_attrs.has_key('preferredlanguage'):
+ default_locale = conf.get(user_attrs['domain'], 'default_locale')
+ if default_locale == None:
+ default_locale = conf.get(user_attrs['domain'], 'default_locale')
+ if default_locale == None:
+ default_locale = 'en_US'
+
+ user_attrs['preferredlanguage'] = default_locale
+
try:
mail = kw['primary_mail'] % user_attrs
mail = utils.translate(mail, user_attrs['preferredlanguage'])
@@ -91,6 +100,15 @@ class KolabRecipientpolicy(object):
elif not user_attrs['domain'] == kw['primary_domain']:
user_attrs['domain'] = kw['primary_domain']
+ if not user_attrs.has_key('preferredlanguage'):
+ default_locale = conf.get(user_attrs['domain'], 'default_locale')
+ if default_locale == None:
+ default_locale = conf.get(user_attrs['domain'], 'default_locale')
+ if default_locale == None:
+ default_locale = 'en_US'
+
+ user_attrs['preferredlanguage'] = default_locale
+
try:
exec("alternative_mail_routines = %s" % kw['secondary_mail'])
except Exception, e: