only try and load the old config if the file exists

This commit is contained in:
Damien Churchill 2009-09-24 15:55:21 +00:00
commit 5c5a0712b0

View file

@ -450,6 +450,7 @@ class DelugeWeb(component.Component):
super(DelugeWeb, self).__init__("DelugeWeb") super(DelugeWeb, self).__init__("DelugeWeb")
self.config = configmanager.ConfigManager("web.conf", CONFIG_DEFAULTS) self.config = configmanager.ConfigManager("web.conf", CONFIG_DEFAULTS)
if os.path.exists(configmanager.get_config_dir("webui06.conf")):
old_config = configmanager.ConfigManager("webui06.conf") old_config = configmanager.ConfigManager("webui06.conf")
if old_config.config: if old_config.config:
# we have an old config file here to handle so we should move # we have an old config file here to handle so we should move
@ -458,7 +459,7 @@ class DelugeWeb(component.Component):
for key in OLD_CONFIG_KEYS: for key in OLD_CONFIG_KEYS:
self.config[key] = old_config[key] self.config[key] = old_config[key]
# We need to base64 encode the passwords since utf-8 can't handle # We need to base64 encode the passwords since json can't handle
# them otherwise. # them otherwise.
from base64 import encodestring from base64 import encodestring
self.config["old_pwd_md5"] = encodestring(old_config["pwd_md5"]) self.config["old_pwd_md5"] = encodestring(old_config["pwd_md5"])