[Python-modules-commits] [python-vertica] 01/03: Import python-vertica_0.6.6.orig.tar.gz

Jean Baptiste Favre jbfavre-guest at moszumanska.debian.org
Sun Aug 21 09:42:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

jbfavre-guest pushed a commit to branch master
in repository python-vertica.

commit ec59c66dc55bc1fa0f321e3bae5a0e670157b1bc
Author: Jean Baptiste Favre <debian at jbfavre.org>
Date:   Sun Aug 21 11:10:07 2016 +0200

    Import python-vertica_0.6.6.orig.tar.gz
---
 setup.py                                           | 10 ++++-----
 vertica_python/__init__.py                         |  2 +-
 .../vertica/messages/frontend_messages/password.py | 25 +++++++++++++++-------
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/setup.py b/setup.py
index 17452bd..ebc4a48 100644
--- a/setup.py
+++ b/setup.py
@@ -10,10 +10,10 @@ opts = ReqOpts(None, 'git')
 # version should use the format 'x.x.x' (instead of 'vx.x.x')
 setup(
     name='vertica-python',
-    version='0.6.5',
+    version='0.6.6',
     description='A native Python client for the Vertica database.',
-    author='Justin Berka, Alex Kim, Kenneth Tran',
-    author_email='justin.berka at gmail.com, alex.kim at uber.com, tran at uber.com',
+    author='Justin Berka, Alex Kim',
+    author_email='justin.berka at gmail.com, alex.kim at uber.com',
     url='https://github.com/uber/vertica-python/',
     keywords="database vertica",
     packages=find_packages(),
@@ -21,8 +21,8 @@ setup(
     install_requires=[
         'python-dateutil>=1.5',
         'pytz',
-        'ordereddict==1.1',
-        'future'
+        'future',
+        'six>=1.10.0'
     ],
     extras_require={'namedparams': ['psycopg2>=2.5.1']},
     classifiers=[
diff --git a/vertica_python/__init__.py b/vertica_python/__init__.py
index 431deda..cd486e6 100644
--- a/vertica_python/__init__.py
+++ b/vertica_python/__init__.py
@@ -6,7 +6,7 @@ from vertica_python.vertica.connection import Connection
 # Main module for this library.
 
 # The version number of this library.
-version_info = (0, 6, 5)
+version_info = (0, 6, 6)
 
 __version__ = '.'.join(map(str, version_info))
 
diff --git a/vertica_python/vertica/messages/frontend_messages/password.py b/vertica_python/vertica/messages/frontend_messages/password.py
index 90258d4..3550a6c 100644
--- a/vertica_python/vertica/messages/frontend_messages/password.py
+++ b/vertica_python/vertica/messages/frontend_messages/password.py
@@ -10,6 +10,7 @@ import hashlib
 
 from struct import pack
 
+import six
 from vertica_python.vertica.messages.message import FrontendMessage
 from vertica_python.vertica.messages.backend_messages.authentication import Authentication
 
@@ -31,14 +32,22 @@ class Password(FrontendMessage):
         elif self.auth_method == Authentication.CRYPT_PASSWORD:
             return crypt.crypt(self.password, self.options['salt'])
         elif self.auth_method == Authentication.MD5_PASSWORD:
-            m = hashlib.md5()
-            m.update(self.password + self.options['user'])
-            self.password = m.hexdigest()
-
-            m = hashlib.md5()
-            m.update(self.password + self.options['salt'])
-            self.password = m.hexdigest()
-            return 'md5' + self.password
+            for key in 'user', 'salt':
+                m = hashlib.md5()
+                m.update(self.password + self.options[key])
+                hexdigest = m.hexdigest()
+                if six.PY3:
+                    # In python3 the output of m.hexdigest() is a unicode string,
+                    # so has to be converted to bytes before concat'ing with
+                    # the password bytes.
+                    hexdigest  = bytes(hexdigest, 'ascii')
+                self.password = hexdigest
+
+            prefix = 'md5'
+            if six.PY3:
+                # Same workaround for bytes here.
+                prefix = bytes(prefix, 'ascii')
+            return prefix + self.password
         else:
             raise ValueError("unsupported authentication method: {0}".format(self.auth_method))
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-vertica.git



More information about the Python-modules-commits mailing list