summaryrefslogtreecommitdiff
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-05-16 18:42:57 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-05-16 18:44:34 (GMT)
commit2086e982f410d70c11a9da7eb463cd1b917c8175 (patch)
treee96d3376e7836ad5e5bd3ebeb4882f38b231cc68 /pykolab
parent576a71426204e91a9d55a788df30babf9f6e848a (diff)
downloadpykolab-2086e982f410d70c11a9da7eb463cd1b917c8175.tar.gz
Catch the cases where a recipient policy fails
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/plugins/recipientpolicy/__init__.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py
index 4a19132..6ca70ef 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -121,7 +121,14 @@ class KolabRecipientpolicy(object):
_domains = [ kw['primary_domain'] ] + kw['secondary_domains']
for attr in [ 'givenname', 'sn', 'surname' ]:
- user_attrs[attr] = utils.translate(user_attrs[attr], user_attrs['preferredlanguage'])
+ try:
+ user_attrs[attr] = utils.translate(user_attrs[attr], user_attrs['preferredlanguage'])
+ except Exception, errmsg:
+ log.error(_("An error occurred in composing the secondary mail attribute for entry %r") % (user_attrs['id']))
+ if conf.debuglevel > 8:
+ import traceback
+ traceback.print_exc()
+ return []
for number in alternative_mail_routines.keys():
for routine in alternative_mail_routines[number].keys():
@@ -131,8 +138,12 @@ class KolabRecipientpolicy(object):
log.debug(_("Appending additional mail address: %s") % (retval), level=8)
alternative_mail.append(retval)
- except KeyError, e:
- log.warning(_("Attribute substitution for 'alternative_mail' failed in Recipient Policy"))
+ except Exception, errmsg:
+ log.error(_("Policy for secondary email address failed: %r") % (errmsg))
+ if conf.debuglevel > 8:
+ import traceback
+ traceback.print_exc()
+ return []
for _domain in kw['secondary_domains']:
user_attrs['domain'] = _domain