[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - scripting/source

Caolán McNamara caolanm at redhat.com
Tue Jun 18 13:52:27 PDT 2013


 scripting/source/pyprov/mailmerge.py |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 350994ffdc51787ecd51a8b7ce4e504c2432dd9d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 17 11:08:15 2013 +0100

    Resolves: fdo#55411 python 2 vs 3 str/bytes encoding issues
    
    Change-Id: Ic1aac1609f3a1fcbd0af9a1c9ecc07a735c8785a
    (cherry picked from commit 06f22f5ae0eafe094b280f03c770eebdbb33d403)
    Reviewed-on: https://gerrit.libreoffice.org/4351
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 18b476c..f70f034 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -239,11 +239,14 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
 			encode_base64(msgattachment)
 			fname = attachment.ReadableName
 			try:
-				fname.encode('ascii')
+				msgattachment.add_header('Content-Disposition', 'attachment', \
+					filename=fname)
 			except:
-				fname = ('utf-8','',fname.encode('utf-8'))
-			msgattachment.add_header('Content-Disposition', 'attachment', \
-				filename=fname)
+				msgattachment.add_header('Content-Disposition', 'attachment', \
+					filename=('utf-8','',fname))
+			if dbg:
+				print(("PyMailSMTPService attachmentheader: ", str(msgattachment)), file=dbgout)
+
 			msg.attach(msgattachment)
 
 		uniquer = {}


More information about the Libreoffice-commits mailing list