summaryrefslogtreecommitdiffstats
path: root/deluge/core/core.py
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2017-02-22 13:40:17 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2017-02-23 00:35:43 +0000
commitb2db96e4df86ef38d79b9c304d527e793597260c (patch)
treea123a1fdcb73eb66f6aca87bf3ccf6048e80a69c /deluge/core/core.py
parent52a85cb91cc3f536941133bfff1ef26f6855e151 (diff)
downloaddeluge-b2db96e4df86ef38d79b9c304d527e793597260c.tar.gz
deluge-b2db96e4df86ef38d79b9c304d527e793597260c.tar.bz2
deluge-b2db96e4df86ef38d79b9c304d527e793597260c.zip
[Py2to3] Refactor out usage of unicode and basestring
- Python 3 renames `unicode` type to `str` and introduces `bytes` type. - Python 2.7 has `bytes` but is only an alias for `str` so restricted to comparisons but helps keep compatibility. - To test for unicode string on Py2 and Py3 uses the "''.__class__" type. - Remove usage of utf8encode and just encode, problems with bytes being passed in code will be picked up faster. - Where possible refactor out isinstance for try..except duck-typing.
Diffstat (limited to 'deluge/core/core.py')
-rw-r--r--deluge/core/core.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/deluge/core/core.py b/deluge/core/core.py
index f0d2eb523..52cacafdf 100644
--- a/deluge/core/core.py
+++ b/deluge/core/core.py
@@ -710,7 +710,7 @@ class Core(component.Component):
if 'owner' in options and not self.core.authmanager.has_account(options['owner']):
raise DelugeError('Username "%s" is not known.' % options['owner'])
- if isinstance(torrent_ids, basestring):
+ if not isinstance(torrent_ids, (list, tuple)):
torrent_ids = [torrent_ids]
for torrent_id in torrent_ids: