From 639eefcf1d3ff1c404324e47485154275a2742aa Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 28 Oct 2015 13:49:25 +0000 Subject: [PATCH] [Core] Supress warnings with fresh config * Test TMState has torrents before attempting old state update. * Only warn about missing fastresume if torrents in session. --- deluge/core/torrentmanager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 55dbaa2d6..8c87b37df 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -653,7 +653,7 @@ class TorrentManager(component.Component): # Try to use an old state try: state_tmp = TorrentState() - if dir(state.torrents[0]) != dir(state_tmp): + if state.torrents and 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)) @@ -772,7 +772,8 @@ class TorrentManager(component.Component): resume_data = lt.bdecode(fastresume_file.read()) fastresume_file.close() except (EOFError, IOError, Exception), e: - log.warning("Unable to load fastresume file: %s", e) + if self.torrents: + log.warning("Unable to load fastresume file: %s", e) resume_data = None else: log.info("Successfully loaded fastresume file: %s", _filepath)