Module: deluge
Branch: master
Commit: 89d04a393b986cf862aec85bbb65a31aa36ebb8c

Author: Pedro Algarvio <[email protected]>
Date:   Mon Apr 25 14:35:01 2011 +0100

Upgrade old auth file, save it and reload it.

---

 deluge/core/authmanager.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/deluge/core/authmanager.py b/deluge/core/authmanager.py
index 4e07089..0d45a8f 100644
--- a/deluge/core/authmanager.py
+++ b/deluge/core/authmanager.py
@@ -221,6 +221,7 @@ class AuthManager(component.Component):
         )
 
     def __load_auth_file(self):
+        save_and_reload = False
         auth_file = configmanager.get_config_dir("auth")
         # Check for auth file and create if necessary
         if not os.path.exists(auth_file):
@@ -254,6 +255,8 @@ class AuthManager(component.Component):
                             "using AUTH_LEVEL_DEFAULT(%s)..", username,
                             AUTH_LEVEL_DEFAULT)
                 authlevel = AUTH_LEVEL_DEFAULT
+                # This is probably an old auth file
+                save_and_reload = True
             elif len(lsplit) == 3:
                 username, password, authlevel = lsplit
             else:
@@ -279,6 +282,10 @@ class AuthManager(component.Component):
             self.__create_localclient_account()
             self.write_auth_file()
 
+        if save_and_reload:
+            log.info("Re-writing auth file (upgrade)")
+            self.write_auth_file()
+
 
     def __create_auth_file(self):
         auth_file = configmanager.get_config_dir("auth")

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