check url in functions instead

This commit is contained in:
Marcos Pinto 2007-09-18 02:25:32 +00:00
parent 7338806613
commit e3188695c6
2 changed files with 7 additions and 5 deletions

View File

@ -94,10 +94,12 @@ def add_torrent_file(torrent_files):
def add_torrent_url(torrent_url):
"""Adds torrents to the core via url"""
core = get_core()
result = core.add_torrent_url(torrent_url)
if result is False:
# The torrent url was not added successfully.
log.warning("Torrent %s url was not added successfully.", torrent_url)
from deluge.common import is_url
if is_url(torrent_url):
result = core.add_torrent_url(torrent_url)
if result is False:
# The torrent url was not added successfully.
log.warning("Torrent %s url was not added successfully.", torrent_url)
def remove_torrent(torrent_ids):
"""Removes torrent_ids from the core.. Expects a list of torrent_ids"""

View File

@ -63,7 +63,7 @@ class AddTorrentUrl:
self.response = self.dlg.run()
url = self.entry.get_text()
self.dlg.destroy()
if self.response == 1 and deluge.common.is_url(url):
if self.response == 1:
return url
else:
return None