From e3188695c6d48f4e90e2428a0d43aad9d73960c6 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Tue, 18 Sep 2007 02:25:32 +0000 Subject: [PATCH] check url in functions instead --- deluge/ui/functions.py | 10 ++++++---- deluge/ui/gtkui/addtorrenturl.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/deluge/ui/functions.py b/deluge/ui/functions.py index 5de6bc472..c1cbbcd4a 100644 --- a/deluge/ui/functions.py +++ b/deluge/ui/functions.py @@ -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""" diff --git a/deluge/ui/gtkui/addtorrenturl.py b/deluge/ui/gtkui/addtorrenturl.py index d97fb0152..5f11c1a4d 100644 --- a/deluge/ui/gtkui/addtorrenturl.py +++ b/deluge/ui/gtkui/addtorrenturl.py @@ -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