diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2017-07-03 10:41:09 +0100 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2018-06-26 12:42:26 +0100 |
commit | 277576268c51431196a84ebd0789ad415cf4e58e (patch) | |
tree | 7c854cfa9212dd8b0501f20e63fe62afeec6cee8 /deluge/ui/web | |
parent | 74aa0db95603b2396fe9a0f297e8d80a056be95e (diff) | |
download | deluge-277576268c51431196a84ebd0789ad415cf4e58e.tar.gz deluge-277576268c51431196a84ebd0789ad415cf4e58e.tar.bz2 deluge-277576268c51431196a84ebd0789ad415cf4e58e.zip |
[Py2to3] Replace deprecated base64.(de|en)codestring
* In Py3 base64.encodestring is deprecated so rather than use the
Py3 only encodebytes instead use b64encode. The other advantage is
that with issue a consistent TypeError is raised that we can catch.
Diffstat (limited to 'deluge/ui/web')
-rw-r--r-- | deluge/ui/web/auth.py | 6 | ||||
-rw-r--r-- | deluge/ui/web/json_api.py | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py index 3ab8ccf9f..3929f949f 100644 --- a/deluge/ui/web/auth.py +++ b/deluge/ui/web/auth.py @@ -143,11 +143,11 @@ class Auth(JSONComponent): elif 'old_pwd_md5' in config.config: # We are using the 1.1 webui auth method log.debug('Received a password via the 1.1 auth method') - from base64 import decodestring + from base64 import b64decode m = hashlib.md5() - m.update(decodestring(config['old_pwd_salt'])) + m.update(b64decode(config['old_pwd_salt'])) m.update(password.encode('utf8')) - if m.digest() == decodestring(config['old_pwd_md5']): + if m.digest() == b64decode(config['old_pwd_md5']): # We want to move the password over to sha1 and remove # the old passwords from the config file. diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 1cc78610c..db9df59fb 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -9,13 +9,13 @@ from __future__ import division, unicode_literals -import base64 import cgi import json import logging import os import shutil import tempfile +from base64 import b64encode from types import FunctionType from twisted.internet import defer, reactor @@ -703,7 +703,7 @@ class WebApi(JSONComponent): else: filename = os.path.basename(torrent['path']) with open(torrent['path'], 'rb') as _file: - fdump = base64.encodestring(_file.read()) + fdump = b64encode(_file.read()) log.info( 'Adding torrent from file `%s` with options `%r`', filename, torrent['options'], @@ -903,7 +903,7 @@ class WebApi(JSONComponent): client.core.rescan_plugins() return True with open(path, 'rb') as _file: - plugin_data = base64.encodestring(_file.read()) + plugin_data = b64encode(_file.read()) def on_upload_complete(*args): client.core.rescan_plugins() |