Moved core.conf config upgrade to core instead of pref's manager.

This commit is contained in:
Pedro Algarvio 2011-05-10 20:15:33 +01:00
parent 74618d5a65
commit 81ca9952e9
2 changed files with 8 additions and 6 deletions

View File

@ -113,6 +113,8 @@ class Core(component.Component):
# Get the core config
self.config = deluge.configmanager.ConfigManager("core.conf")
self.config.run_converter((0, 1), 2, self.__migrate_config_1_to_2)
self.config.save()
# If there was an interface value from the command line, use it, but
# store the one in the config so we can restore it on shutdown
@ -159,6 +161,12 @@ class Core(component.Component):
except Exception, e:
log.warning("Failed to load lt state: %s", e)
def __migrate_config_1_to_2(self, config):
if 'sequential_download' not in config:
config['sequential_download'] = False
return config
def save_dht_state(self):
"""Saves the dht state to a file"""
try:

View File

@ -154,7 +154,6 @@ class PreferencesManager(component.Component):
"attribute to shared.")
self.config["shared"] = self.config["public"]
del self.config["public"]
self.config.run_converter((0, 1), 2, self.__migrate_config_1_to_2)
def start(self):
self.core = component.get("Core")
@ -474,8 +473,3 @@ class PreferencesManager(component.Component):
def _on_set_cache_expiry(self, key, value):
log.debug("%s: %s", key, value)
self.session_set_setting("cache_expiry", value)
def __migrate_config_1_to_2(self, config):
if 'sequential_download' not in config:
config['sequential_download'] = DEFAULT_PREFS['sequential_download']
return config