Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1669

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/69/1669/1

fdo#59249: mailmerge.py: adapt to changes in smtplib:

Apparently the login() method in Python 3.3 expects str arguments for
user and password, since it calls encode on them, but for Python 2.6 the
"encode" calls were explicitly added in the caller since login() does
not encode itself; add an ugly version check for that.

Change-Id: Iebfce44073a837e9cb845855ba448d5b6a2ebd11
(cherry picked from commit 1a5b3d8e4d88aa27647cc7b99623dd6f6e706bbc)
---
M scripting/source/pyprov/mailmerge.py
1 file changed, 17 insertions(+), 8 deletions(-)



diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index d76322e..c606143 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -99,9 +99,12 @@
                        self.server.starttls()
                        self.server.ehlo()
 
-               user = xAuthenticator.getUserName().encode('ascii')
-               password = xAuthenticator.getPassword().encode('ascii')
-               if user != b'':
+               user = xAuthenticator.getUserName()
+               password = xAuthenticator.getPassword()
+               if user != '':
+                       if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii"
+                               user = user.encode('ascii')
+                               password = password.encode('ascii')
                        if dbg:
                                print("Logging in, username of" + user, file=dbgout)
                        self.server.login(user, password)
@@ -279,9 +282,12 @@
                        self.server = imaplib.IMAP4(server, port)
                print("AFTER", file=dbgout)
                        
-               user = xAuthenticator.getUserName().encode('ascii')
-               password = xAuthenticator.getPassword().encode('ascii')
-               if user != b'':
+               user = xAuthenticator.getUserName()
+               password = xAuthenticator.getPassword()
+               if user != '':
+                       if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii"
+                               user = user.encode('ascii')
+                               password = password.encode('ascii')
                        if dbg:
                                print("Logging in, username of" + user, file=dbgout)
                        self.server.login(user, password)
@@ -348,8 +354,11 @@
                        self.server = poplib.POP3(server, port)
                print("AFTER", file=dbgout)
                        
-               user = xAuthenticator.getUserName().encode('ascii')
-               password = xAuthenticator.getPassword().encode('ascii')
+               user = xAuthenticator.getUserName()
+               password = xAuthenticator.getPassword()
+               if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii"
+                       user = user.encode('ascii')
+                       password = password.encode('ascii')
                if dbg:
                        print("Logging in, username of" + user, file=dbgout)
                self.server.user(user)

-- 
To view, visit https://gerrit.libreoffice.org/1669
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iebfce44073a837e9cb845855ba448d5b6a2ebd11
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Michael Stahl <mstahl@redhat.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.