diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py --- a/pykolab/plugins/recipientpolicy/__init__.py +++ b/pykolab/plugins/recipientpolicy/__init__.py @@ -70,6 +70,11 @@ user_attrs['preferredlanguage'] = default_locale + # strip whitespace from common attribs used to build the address + for attr in ['surname', 'sn', 'givenname']: + if attr in user_attrs: + user_attrs[attr] = user_attrs[attr].strip() + try: mail = kw['primary_mail'] % user_attrs mail = utils.translate(mail, user_attrs['preferredlanguage']) @@ -122,7 +127,7 @@ for attr in [ 'givenname', 'sn', 'surname' ]: try: - user_attrs[attr] = utils.translate(user_attrs[attr], user_attrs['preferredlanguage']) + user_attrs[attr] = utils.translate(user_attrs[attr].strip(), 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: