diff options
author | Calum Lind <calumlind@gmail.com> | 2017-03-05 09:29:51 +0000 |
---|---|---|
committer | Calum Lind <calumlind@gmail.com> | 2017-06-05 22:25:29 +0100 |
commit | 481f77934983284b67b7546470f52c9799bc6184 (patch) | |
tree | 6efeac6d6c038809f989385ec2e743ede0b2a4e1 /deluge/ui/common.py | |
parent | ede0f710f814c62f9e6625c7b166fb7b1fcf5942 (diff) | |
download | deluge-481f77934983284b67b7546470f52c9799bc6184.tar.gz deluge-481f77934983284b67b7546470f52c9799bc6184.tar.bz2 deluge-481f77934983284b67b7546470f52c9799bc6184.zip |
[Python3] Fixes to make code backward compatible
* Continuation of updating code to Python 3 with Python 2 fallback.
* Using io.open allows files to be encoded and decoded automatically on write and read. This
maintains the python boundaries of unicode in code and bytes for output/files so less
explicit encoding or decoding.
* io.StringIO is the replacement for StringIO and will only accept unicode strings.
* io.BytesIO is used where bytes output is required by the enclosing method.
* Update bencode for full compatibility.
Diffstat (limited to 'deluge/ui/common.py')
-rw-r--r-- | deluge/ui/common.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/deluge/ui/common.py b/deluge/ui/common.py index 7f1f09d73..ef7dda9af 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -166,7 +166,7 @@ del _ DEFAULT_HOST = '127.0.0.1' DEFAULT_PORT = 58846 DEFAULT_HOSTS = { - 'hosts': [(sha(str(time.time())).hexdigest(), DEFAULT_HOST, DEFAULT_PORT, '', '')] + 'hosts': [(sha(str(time.time()).encode('utf8')).hexdigest(), DEFAULT_HOST, DEFAULT_PORT, '', '')] } # The keys from session statistics for cache status. |