diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-27 07:18:20 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-28 13:01:26 +0100 |
commit | a76d229fa9d800e96d88f5f37981251722e153e6 (patch) | |
tree | 6988557476115a64a852522c03f0139a4bff8b16 /scripting/source/pyprov/mailmerge.py | |
parent | 268b2b4cd5507e63830df71b3aa21ea022c0b48f (diff) |
sys.version is for displaying; use sys.version_info for version check
Change-Id: If0d26019d9f842bcf56c1e01c46cc86c21523c3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87476
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'scripting/source/pyprov/mailmerge.py')
-rw-r--r-- | scripting/source/pyprov/mailmerge.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index 079744007816..fadceb1e1e56 100644 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -127,7 +127,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): user = xAuthenticator.getUserName() password = xAuthenticator.getPassword() if user != '': - if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii" + if sys.version_info < (3,0): # fdo#59249 i#105669 Python 2 needs "ascii" user = user.encode('ascii') password = password.encode('ascii') if dbg: @@ -198,8 +198,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): except: #it's a bytesequence, get raw bytes textbody = textbody.value - if sys.version >= '3': - if sys.version_info.minor < 3 or (sys.version_info.minor == 3 and sys.version_info.micro <= 1): + if sys.version_info >= (3,0): + if sys.version_info <= (3,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 @@ -333,7 +333,7 @@ class PyMailIMAPService(unohelper.Base, XMailService): user = xAuthenticator.getUserName() password = xAuthenticator.getPassword() if user != '': - if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii" + if sys.version_info < (3,0): # fdo#59249 i#105669 Python 2 needs "ascii" user = user.encode('ascii') password = password.encode('ascii') if dbg: @@ -411,7 +411,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService): user = xAuthenticator.getUserName() password = xAuthenticator.getPassword() - if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii" + if sys.version_info < (3,0): # fdo#59249 i#105669 Python 2 needs "ascii" user = user.encode('ascii') password = password.encode('ascii') if dbg: |