aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/mgagit
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-04-27 13:56:03 +0000
committerColin Guthrie <colin@mageia.org>2014-04-27 13:56:03 +0000
commiteda184097418797f08142983be8a0e2e0ce0b84f (patch)
tree7c1b6d288bec0aef4bedc23b79e39e6a364d6df9 /deployment/mgagit
parent62cf71a9a07f1120e0db6fb75c3be4238938be34 (diff)
downloadpuppet-eda184097418797f08142983be8a0e2e0ce0b84f.tar
puppet-eda184097418797f08142983be8a0e2e0ce0b84f.tar.gz
puppet-eda184097418797f08142983be8a0e2e0ce0b84f.tar.bz2
puppet-eda184097418797f08142983be8a0e2e0ce0b84f.tar.xz
puppet-eda184097418797f08142983be8a0e2e0ce0b84f.zip
mgagit: Hopefully work around utf8 encoding issue in emails mga#12374
Diffstat (limited to 'deployment/mgagit')
-rwxr-xr-xdeployment/mgagit/templates/git_multimail.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/deployment/mgagit/templates/git_multimail.py b/deployment/mgagit/templates/git_multimail.py
index f1739b43..4b5f6f13 100755
--- a/deployment/mgagit/templates/git_multimail.py
+++ b/deployment/mgagit/templates/git_multimail.py
@@ -352,6 +352,15 @@ def addr_header_encode(text, header_name=None):
"""Encode and line-wrap the value of an email header field containing
email addresses."""
+ # (cg) It seems that From: names (or perhaps Subject: headers) that contain
+ # a UTF8 character before the first space confuse the older python Header()
+ # class. This does not appear to be needed in newer python versions, but
+ # this little workaround seems to help on 2.7.1 on valstar mga1.
+ try:
+ unicode(text)
+ except UnicodeDecodeError:
+ text = text.decode('utf-8')
+
return Header(
', '.join(
formataddr((header_encode(name), emailaddr))