Author: andar

Revision: 5545

Log:
        Move the InvalidTorrentError check to torrentmanager.remove

Diff:
Modified: trunk/deluge/core/core.py
===================================================================
--- trunk/deluge/core/core.py   2009-07-24 23:36:43 UTC (rev 5544)
+++ trunk/deluge/core/core.py   2009-07-24 23:40:03 UTC (rev 5545)
@@ -335,9 +335,6 @@
         
         """
         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

Modified: trunk/deluge/core/torrentmanager.py
===================================================================
--- trunk/deluge/core/torrentmanager.py 2009-07-24 23:36:43 UTC (rev 5544)
+++ trunk/deluge/core/torrentmanager.py 2009-07-24 23:40:03 UTC (rev 5545)
@@ -54,6 +54,7 @@
 
 
 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 @@
         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))
 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to