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

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


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

New commits:
commit 540a681e4d6ed0d88a542c843dbf534fb661abf8
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/4350
    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