summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-10 16:49:34 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-10 16:49:34 +0100
commitd024ba1a14d7ad833879ed9ff033729edf5ccd2c (patch)
treedee8368f26902b1e223a827fdbbfd99778c69fa1 /pykolab
parent5a721a992e6aea9df92e8bd2b02ab147c92e8f0b (diff)
downloadpykolab-d024ba1a14d7ad833879ed9ff033729edf5ccd2c.tar.gz
Make sure we transliterate the components before we push them in to a policy (#1508)
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/plugins/recipientpolicy/__init__.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py
index 9d50e83..e3d6b65 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -116,29 +116,34 @@ class KolabRecipientpolicy(object):
alternative_mail = []
- #print "%r" % (alternative_mail_routines)
+ log.debug(_("Alternative mail routines: %r") % (alternative_mail_routines), level=8)
_domains = [ kw['primary_domain'] ] + kw['secondary_domains']
+ for attr in [ 'givenname', 'sn', 'surname' ]:
+ user_attrs[attr] = utils.translate(user_attrs[attr], user_attrs['preferredlanguage'])
+
for number in alternative_mail_routines.keys():
for routine in alternative_mail_routines[number].keys():
try:
exec("retval = '%s'.%s" % (routine,alternative_mail_routines[number][routine] % user_attrs))
+
+ 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"))
- #log.debug(_("Appending additional mail address: %s") % (retval), level=8)
- alternative_mail.append(utils.translate(retval, user_attrs['preferredlanguage']))
-
for _domain in kw['secondary_domains']:
user_attrs['domain'] = _domain
try:
exec("retval = '%s'.%s" % (routine,alternative_mail_routines[number][routine] % user_attrs))
+
+ 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"))
- #log.debug(_("Appending additional mail address: %s") % (retval), level=8)
- alternative_mail.append(utils.translate(retval, user_attrs['preferredlanguage']))
-
alternative_mail = utils.normalize(alternative_mail)
alternative_mail = list(set(alternative_mail))