Skip to content

Commit

Permalink
Python 3 bugfix: session decode password
Browse files Browse the repository at this point in the history
  • Loading branch information
katyukha committed Sep 8, 2015
1 parent 071f201 commit bbafd4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -2,3 +2,4 @@
omit =
openerp_proxy/tests/*.*
openerp_proxy/main.py
openerp_proxy/ext/log_execute_console.py
8 changes: 4 additions & 4 deletions openerp_proxy/session.py
Expand Up @@ -234,13 +234,13 @@ def get_db(self, url_or_index, **kwargs):
if self.option('store_passwords') and 'password' in ep_args:
import base64
crypter, password = base64.b64decode(ep_args.pop('password').encode('utf8')).split(b':')
if crypter == 'simplecrypt': # pragma: no cover
if crypter == b'simplecrypt': # pragma: no cover
import simplecrypt
ep_args['pwd'] = simplecrypt.decrypt(Client.to_url(ep_args), base64.b64decode(password))
elif crypter == 'plain':
elif crypter == b'plain':
ep_args['pwd'] = password.decode('utf-8')
else:
raise Exception("Unknown crypter used in session")
else: # pragma: no cover
raise Exception("Unknown crypter (%s) used in session" % repr(crypter))
else:
ep_args['pwd'] = getpass('Password: ') # pragma: no cover

Expand Down

0 comments on commit bbafd4e

Please sign in to comment.