Module: deluge
Branch: master
Commit: 81ca9952e9dee9130264a175891320b8d8d6b60b

Author: Pedro Algarvio <[email protected]>
Date:   Tue May 10 20:15:33 2011 +0100

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

---

 deluge/core/core.py               |    8 ++++++++
 deluge/core/preferencesmanager.py |    6 ------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/deluge/core/core.py b/deluge/core/core.py
index d701607..6537ce3 100644
--- a/deluge/core/core.py
+++ b/deluge/core/core.py
@@ -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:
diff --git a/deluge/core/preferencesmanager.py 
b/deluge/core/preferencesmanager.py
index 76b1d41..d42be33 100644
--- a/deluge/core/preferencesmanager.py
+++ b/deluge/core/preferencesmanager.py
@@ -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

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to