diff options
author | David Planella <david.planella@gmail.com> | 2009-01-29 00:22:52 +0100 |
---|---|---|
committer | David Planella <david.planella@gmail.com> | 2009-01-29 00:22:52 +0100 |
commit | 518b3843c0117f24b1b277a724169fb616604e4d (patch) | |
tree | 01ab5cbe392ff3a8e851dae1be4eb3a8cf8ed439 /Mailman/Handlers/Decorate.py | |
parent | 42fcf522d7818e9e1ee922d1a68824b0f6dcc83d (diff) | |
parent | c0da6af58657b1fe5730d3dea0e78bc17dac490a (diff) | |
download | mailman2-518b3843c0117f24b1b277a724169fb616604e4d.tar.gz mailman2-518b3843c0117f24b1b277a724169fb616604e4d.tar.xz mailman2-518b3843c0117f24b1b277a724169fb616604e4d.zip |
Merged from upstream
Diffstat (limited to 'Mailman/Handlers/Decorate.py')
-rw-r--r-- | Mailman/Handlers/Decorate.py | 14 |
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() |