summaryrefslogtreecommitdiffstats
path: root/pykolab/plugins/recipientpolicy/__init__.py
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:08:50 +0100
commit5c1c4c70bae2be6e50063434e8ec69ef89bd4983 (patch)
tree41dd12b1281c997564a98c3c662b8fb2f0e7196f /pykolab/plugins/recipientpolicy/__init__.py
parentac539faed494c3abdf6abbbae42fbb9dfcb4aad8 (diff)
downloadpykolab-5c1c4c70bae2be6e50063434e8ec69ef89bd4983.tar.gz
Search for or fallback to the default_locale for the user's preferredlanguage attribute. (#839)
Diffstat (limited to 'pykolab/plugins/recipientpolicy/__init__.py')
-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: