Allow incomplete options dictionaries when adding a torrent. The

missing keys will be replaced by defaults.
This commit is contained in:
Andrew Resch 2008-02-07 07:20:17 +00:00
parent 737b95250d
commit 9a1d5e9bfa
1 changed files with 17 additions and 12 deletions

View File

@ -174,22 +174,27 @@ class TorrentManager(component.Component):
handle = None
# Check if options is None and load defaults
options_keys = [
"compact_allocation",
"max_connections_per_torrent",
"max_upload_slots_per_torrent",
"max_upload_speed_per_torrent",
"max_download_speed_per_torrent",
"prioritize_first_last_pieces",
"download_location",
"add_paused",
"default_private"
]
if options == None:
options_keys = [
"compact_allocation",
"max_connections_per_torrent",
"max_upload_slots_per_torrent",
"max_upload_speed_per_torrent",
"max_download_speed_per_torrent",
"prioritize_first_last_pieces",
"download_location",
"add_paused",
"default_private"
]
options = {}
for key in options_keys:
options[key] = self.config[key]
else:
for key in options_keys:
if not options.has_key(key):
options[key] = self.config[key]
if paused is None:
paused = options["add_paused"]