summaryrefslogtreecommitdiffstats
path: root/deluge/core/core.py
diff options
context:
space:
mode:
authorDeepak <github@deepaksandhu.com>2018-07-30 16:14:50 -0500
committerCalum Lind <calumlind+deluge@gmail.com>2018-08-10 17:09:50 +0100
commit585ea88f1f79882635317e3a0e62d838783a3ab5 (patch)
treead835bffea3b0baf583f31a064c9366ecc548460 /deluge/core/core.py
parentf94f58918ed1d77e42d3107e5012d61fad8c54e0 (diff)
downloaddeluge-585ea88f1f79882635317e3a0e62d838783a3ab5.tar.gz
deluge-585ea88f1f79882635317e3a0e62d838783a3ab5.tar.bz2
deluge-585ea88f1f79882635317e3a0e62d838783a3ab5.zip
[Core] Fix torrent pause/resume logic
If the torrent_id argument received in the pause or resume methods is not a string, the methods execute with the un-parsed input and then with parsed input on a second call. A key error exception is thrown from the first call, and the second call succeeds.
Diffstat (limited to 'deluge/core/core.py')
-rw-r--r--deluge/core/core.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/deluge/core/core.py b/deluge/core/core.py
index 691a7c0d2..451b9a88d 100644
--- a/deluge/core/core.py
+++ b/deluge/core/core.py
@@ -627,7 +627,8 @@ class Core(component.Component):
log.debug('Pausing: %s', torrent_id)
if not isinstance(torrent_id, str if not PY2 else basestring):
self.pause_torrents(torrent_id)
- self.torrentmanager[torrent_id].pause()
+ else:
+ self.torrentmanager[torrent_id].pause()
@export
def pause_torrents(self, torrent_ids=None):
@@ -677,7 +678,8 @@ class Core(component.Component):
log.debug('Resuming: %s', torrent_id)
if not isinstance(torrent_id, str if not PY2 else basestring):
self.resume_torrents(torrent_id)
- self.torrentmanager[torrent_id].resume()
+ else:
+ self.torrentmanager[torrent_id].resume()
@export
def resume_torrents(self, torrent_ids=None):