mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-06 16:44:29 +00:00
Move the InvalidTorrentError check to torrentmanager.remove
This commit is contained in:
parent
5977647528
commit
321e042a06
@ -335,9 +335,6 @@ class Core(component.Component):
|
||||
|
||||
"""
|
||||
log.debug("Removing torrent %s from the core.", torrent_id)
|
||||
if torrent_id not in self.torrentmanager.torrents:
|
||||
raise InvalidTorrentError("torrent_id not in session")
|
||||
|
||||
return self.torrentmanager.remove(torrent_id, remove_data)
|
||||
|
||||
@export
|
||||
|
@ -54,6 +54,7 @@ except ImportError:
|
||||
|
||||
|
||||
from deluge.event import *
|
||||
from deluge.error import *
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
@ -462,7 +463,24 @@ class TorrentManager(component.Component):
|
||||
return filedump
|
||||
|
||||
def remove(self, torrent_id, remove_data=False):
|
||||
"""Remove a torrent from the manager"""
|
||||
"""
|
||||
Remove a torrent from the session.
|
||||
|
||||
:param torrent_id: the torrent to remove
|
||||
:type torrent_id: string
|
||||
:param remove_data: if True, remove the downloaded data
|
||||
:type remove_data: bool
|
||||
|
||||
:returns: True if removed successfully, False if not
|
||||
:rtype: bool
|
||||
|
||||
:raises InvalidTorrentError: if the torrent_id is not in the session
|
||||
|
||||
"""
|
||||
|
||||
if torrent_id not in self.torrents:
|
||||
raise InvalidTorrentError("torrent_id not in session")
|
||||
|
||||
# Emit the signal to the clients
|
||||
component.get("EventManager").emit(PreTorrentRemovedEvent(torrent_id))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user