From 553f35eae56e3d140a1500fdc8368bcdf9c2a477 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 11 Feb 2011 01:05:28 +0000 Subject: [PATCH] Fix #1510 - Cannot create a torrent with only non-zero tier trackers --- deluge/ui/gtkui/createtorrentdialog.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/deluge/ui/gtkui/createtorrentdialog.py b/deluge/ui/gtkui/createtorrentdialog.py index 6ee302132..147fd6435 100644 --- a/deluge/ui/gtkui/createtorrentdialog.py +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -285,14 +285,11 @@ class CreateTorrentDialog: tracker = None else: # Create a list of lists [[tier0, ...], [tier1, ...], ...] + tier_dict = {} for tier, tracker in self.trackers_liststore: - try: - tier_list = trackers[tier] - except IndexError: - trackers.insert(tier, []) - - trackers[tier].append(tracker) + tier_dict.setdefault(tier, []).append(tracker) + trackers = [tier_dict[tier] for tier in sorted(tier_dict)] # Get the first tracker in the first tier tracker = trackers[0][0]