aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers/Decorate.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/Handlers/Decorate.py')
-rw-r--r--Mailman/Handlers/Decorate.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py
index 81bf7d33..4a6fb8aa 100644
--- a/Mailman/Handlers/Decorate.py
+++ b/Mailman/Handlers/Decorate.py
@@ -98,8 +98,16 @@ def process(mlist, msg, msgdata):
# TK: Try to keep the message plain by converting the header/
# footer/oldpayload into unicode and encode with mcset/lcset.
# Try to decode qp/base64 also.
- uheader = unicode(header, lcset, 'ignore')
- ufooter = unicode(footer, lcset, 'ignore')
+ # It is possible header/footer is already unicode if it was
+ # interpolated with a unicode.
+ if isinstance(header, unicode):
+ uheader = header
+ else:
+ uheader = unicode(header, lcset, 'ignore')
+ if isinstance(footer, unicode):
+ ufooter = footer
+ else:
+ ufooter = unicode(footer, lcset, 'ignore')
try:
oldpayload = unicode(msg.get_payload(decode=True), mcset)
frontsep = endsep = u''
@@ -130,7 +138,7 @@ def process(mlist, msg, msgdata):
wrap = False
except (LookupError, UnicodeError):
pass
- elif msg.get_type() == 'multipart/mixed':
+ elif msg.get_content_type() == 'multipart/mixed':
# The next easiest thing to do is just prepend the header and append
# the footer as additional subparts
payload = msg.get_payload()