summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-07-15 10:25:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-07-15 10:25:31 +0100
commit24078e3501042e8693ef1f9d3edebbc47e37ce12 (patch)
tree8763dd90c56e096c9dab45f8210b81cb44f94635 /scripting
parenta86af5919e19d989ee9344071b1bb13140cb83ef (diff)
Related: fdo#66761 the double-encoding bug appears gone in python 3.3.2
i.e. I see the bug in our built-in python3 3.3.0 but not in my system python 3.3.2 and there's a raft of email related bug fixes in the 3.3.2/3.3.1 python Changelog Change-Id: I257770cd0ec41fc3b2f2a638009b075b9a2f325f
Diffstat (limited to 'scripting')
-rwxr-xr-xscripting/source/pyprov/mailmerge.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 6ed046b107ff..201b5c9752a0 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -189,8 +189,14 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
#it's a bytesequence, get raw bytes
textbody = textbody.value
if sys.version >= '3':
- #http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
- textbody = textbody.decode('iso8859-1')
+ if sys.version_info.minor < 3 or (sys.version_info.minor == 3 and sys.version_info.micro <= 1):
+ #http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
+ #see http://bugs.python.org/16564, etc. basically it now *seems* to be all ok
+ #in python 3.3.2 onwards, but a little busted in 3.3.0
+
+ textbody = textbody.decode('iso8859-1')
+ else:
+ textbody = textbody.decode('utf-8')
c = Charset('utf-8')
c.body_encoding = QP
textmsg.set_payload(textbody, c)
@@ -472,15 +478,15 @@ class PyMailMessage(unohelper.Base, XMailMessage):
self.bccrecipients.append(bccrecipient)
def getRecipients( self ):
if dbg:
- print("PyMailMessage.getRecipients: " + self.recipients, file=dbgout)
+ print("PyMailMessage.getRecipients: " + str(self.recipients), file=dbgout)
return tuple(self.recipients)
def getCcRecipients( self ):
if dbg:
- print("PyMailMessage.getCcRecipients: " + self.ccrecipients, file=dbgout)
+ print("PyMailMessage.getCcRecipients: " + str(self.ccrecipients), file=dbgout)
return tuple(self.ccrecipients)
def getBccRecipients( self ):
if dbg:
- print("PyMailMessage.getBccRecipients: " + self.bccrecipients, file=dbgout)
+ print("PyMailMessage.getBccRecipients: " + str(self.bccrecipients), file=dbgout)
return tuple(self.bccrecipients)
def addAttachment( self, aMailAttachment ):
if dbg: