summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-11-16 00:52:00 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-11-16 00:52:00 +0000
commit7e1324dad409e2f9319c3347f071364f0c8f12aa (patch)
tree0154c710129ccf932f88d7250cf6abce35d87032 /pykolab
parent31405a32477129f1f8a1a916ffb90b790aaf8949 (diff)
downloadpykolab-7e1324dad409e2f9319c3347f071364f0c8f12aa.tar.gz
The recipient policy should recognize special characters in a given name or surname, and replace them with the equivalent ascii valid in an email address.
This fixes #509.
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/plugins/recipientpolicy/__init__.py6
-rw-r--r--pykolab/utils.py8
2 files changed, 11 insertions, 3 deletions
diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py
index ce9e9bf..07204a2 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -63,7 +63,7 @@ class KolabRecipientpolicy(object):
try:
mail = kw['primary_mail'] % user_attrs
- return mail.lower()
+ return utils.translate(mail.lower())
except KeyError, e:
log.warning(_("Attribute substitution for 'mail' failed in Recipient Policy"))
return user_attrs['mail'].lower()
@@ -105,7 +105,7 @@ class KolabRecipientpolicy(object):
log.warning(_("Attribute substitution for 'alternative_mail' failed in Recipient Policy"))
#log.debug(_("Appending additional mail address: %s") %(retval), level=8)
- alternative_mail.append(retval)
+ alternative_mail.append(utils.translate(retval))
for _domain in kw['secondary_domains']:
user_attrs['domain'] = _domain
@@ -115,7 +115,7 @@ class KolabRecipientpolicy(object):
log.warning(_("Attribute substitution for 'alternative_mail' failed in Recipient Policy"))
#log.debug(_("Appending additional mail address: %s") %(retval), level=8)
- alternative_mail.append(retval)
+ alternative_mail.append(utils.translate(retval))
alternative_mail = utils.normalize(alternative_mail)
diff --git a/pykolab/utils.py b/pykolab/utils.py
index d787eab..079a48c 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -207,6 +207,14 @@ def pop_empty_from_list(_input_list):
def standard_root_dn(domain):
return 'dc=%s' %(',dc='.join(domain.split('.')))
+def translate(mystring):
+ chars = ['Ä', 'Ü', 'Ö', 'ä', 'ü', 'ö', 'ß']
+ simple = ['Ae', 'Ue', 'Oe', 'ae', 'ue', 'oe', 'ss']
+
+ for num in range(0, len(chars)):
+ mystring = mystring.replace(chars[num], simple[num])
+ return mystring
+
def is_service(services):
"""
Checks each item in list services to see if it has a RC script in