summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2017-10-29 22:11:05 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2017-10-29 22:11:11 +0000
commitbcc7a74725abcdbd43b00689c3705bffe7e48480 (patch)
tree5f1d6918af9fa3366691932825a42a7e7ead20c6
parentffb8d9f8c3e6fa00659c7613bd295ed1b06097f1 (diff)
downloaddeluge-bcc7a74725abcdbd43b00689c3705bffe7e48480.tar.gz
deluge-bcc7a74725abcdbd43b00689c3705bffe7e48480.tar.bz2
deluge-bcc7a74725abcdbd43b00689c3705bffe7e48480.zip
[#3112|Console] Fix handling hex for setting peer_tos in config
The token parser was converting hex value to int which is not what should be passed onto libtorrent peer_tos setting.
-rw-r--r--deluge/ui/console/commands/config.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/deluge/ui/console/commands/config.py b/deluge/ui/console/commands/config.py
index 4248edb4f..5d8a6ef62 100644
--- a/deluge/ui/console/commands/config.py
+++ b/deluge/ui/console/commands/config.py
@@ -61,7 +61,11 @@ def atom(next, token):
if token[1] == "-":
return int(token[-1], 0)
else:
- return int(token[1], 0)
+ if token[1].startswith('0x'):
+ # Hex number so return unconverted as string.
+ return token[1].decode("string-escape")
+ else:
+ return int(token[1], 0)
except ValueError:
try:
return float(token[-1])