Author: damoxc

Revision: 5777

Log:
        only try and load the old config if the file exists

Diff:
Modified: trunk/deluge/ui/web/server.py
===================================================================
--- trunk/deluge/ui/web/server.py       2009-09-24 14:26:05 UTC (rev 5776)
+++ trunk/deluge/ui/web/server.py       2009-09-24 15:55:21 UTC (rev 5777)
@@ -450,27 +450,28 @@
         super(DelugeWeb, self).__init__("DelugeWeb")
         self.config = configmanager.ConfigManager("web.conf", CONFIG_DEFAULTS)
         
-        old_config = configmanager.ConfigManager("webui06.conf")
-        if old_config.config:
-            # we have an old config file here to handle so we should move
-            # all the values across to the new config file, and then remove
-            # it.
-            for key in OLD_CONFIG_KEYS:
-                self.config[key] = old_config[key]
-            
-            # We need to base64 encode the passwords since utf-8 can't handle
-            # them otherwise.
-            from base64 import encodestring
-            self.config["old_pwd_md5"] = encodestring(old_config["pwd_md5"])
-            self.config["old_pwd_salt"] = encodestring(old_config["pwd_salt"])
-            
-            # Save our config and if it saved successfully then rename the
-            # old configuration file.
-            if self.config.save():
-                config_dir = os.path.dirname(old_config.config_file)
-                backup_path = os.path.join(config_dir, 'web.conf.old')
-                os.rename(old_config.config_file, backup_path)
-                del old_config
+        if os.path.exists(configmanager.get_config_dir("webui06.conf")):
+            old_config = configmanager.ConfigManager("webui06.conf")
+            if old_config.config:
+                # we have an old config file here to handle so we should move
+                # all the values across to the new config file, and then remove
+                # it.
+                for key in OLD_CONFIG_KEYS:
+                    self.config[key] = old_config[key]
+                
+                # We need to base64 encode the passwords since json can't 
handle
+                # them otherwise.
+                from base64 import encodestring
+                self.config["old_pwd_md5"] = 
encodestring(old_config["pwd_md5"])
+                self.config["old_pwd_salt"] = 
encodestring(old_config["pwd_salt"])
+                
+                # Save our config and if it saved successfully then rename the
+                # old configuration file.
+                if self.config.save():
+                    config_dir = os.path.dirname(old_config.config_file)
+                    backup_path = os.path.join(config_dir, 'web.conf.old')
+                    os.rename(old_config.config_file, backup_path)
+                    del old_config
 
         self.socket = None
         self.top_level = TopLevel()



--~--~---------~--~----~------------~-------~--~----~
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