mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-06 16:38:43 +00:00
Fix overzealous legacy code removal from torrentmanager
This commit is contained in:
parent
7dd276631a
commit
533228ff5e
1 changed files with 11 additions and 0 deletions
|
@ -621,6 +621,17 @@ class TorrentManager(component.Component):
|
||||||
if state is None:
|
if state is None:
|
||||||
state = TorrentManagerState()
|
state = TorrentManagerState()
|
||||||
|
|
||||||
|
# Fixup an old state by adding missing TorrentState options and assigning them None
|
||||||
|
try:
|
||||||
|
if len(state.torrents) > 0:
|
||||||
|
state_tmp = TorrentState()
|
||||||
|
if dir(state.torrents[0]) != dir(state_tmp):
|
||||||
|
for attr in (set(dir(state_tmp)) - set(dir(state.torrents[0]))):
|
||||||
|
for s in state.torrents:
|
||||||
|
setattr(s, attr, getattr(state_tmp, attr, None))
|
||||||
|
except Exception, e:
|
||||||
|
log.exception("Unable to update state file to a compatible version: %s", e)
|
||||||
|
|
||||||
# Reorder the state.torrents list to add torrents in the correct queue
|
# Reorder the state.torrents list to add torrents in the correct queue
|
||||||
# order.
|
# order.
|
||||||
state.torrents.sort(key=operator.attrgetter("queue"), reverse=self.config["queue_new_to_top"])
|
state.torrents.sort(key=operator.attrgetter("queue"), reverse=self.config["queue_new_to_top"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue