online-desktop r7289 - trunk/weblogindriver



Author: marinaz
Date: Tue Oct 28 22:10:17 2008
New Revision: 7289
URL: http://svn.gnome.org/viewvc/online-desktop?rev=7289&view=rev

Log:
Check if an account exists in gconf before creating a new online account.


Modified:
   trunk/weblogindriver/web-login-driver

Modified: trunk/weblogindriver/web-login-driver
==============================================================================
--- trunk/weblogindriver/web-login-driver	(original)
+++ trunk/weblogindriver/web-login-driver	Tue Oct 28 22:10:17 2008
@@ -404,7 +404,7 @@
       self.Changed()
 
   def __str__(self):
-    return "<Account username:%s, type:%s, gconf_dir:%s, enabled:%s, resource_id:%s>" % (self.GetUsername(), self.GetType(), self._get_gconf_dir(), self.GetEnabled(), self._get_resource_id())
+    return "<Account username: %s, type: %s, gconf_dir: %s, enabled: %s, resource_id: %s, object path: %s>" % (self.GetUsername(), self.GetType(), self._get_gconf_dir(), self.GetEnabled(), self._get_resource_id(), self.GetObjectPath())
 
 _dialog = None
 
@@ -816,7 +816,8 @@
             username = str(account.username)
             if accountType not in new_accounts_by_type:
               new_accounts_by_type[accountType] = set()
-            new_accounts_by_type[accountType].add(self.__create_online_account(accountType, username, resource_id=str(account.resource_id)))          
+            new_account = self.__create_online_account(accountType, username, resource_id=str(account.resource_id)) 
+            new_accounts_by_type[accountType].add(new_account)          
             _logger.debug("got username %s", username)        
           else:
             _logger.warn("account.username for the account type %s we expect data for is None" % accountType)
@@ -1076,6 +1077,7 @@
     if not gconf_dir:
       if self.__find_account_in_gconf(account.GetType(), account.GetUsername()):
         _logger.error("found an account in gconf that matches the passed in account object %s, but the passed in account object is missing a gconf_dir" % str(account))
+        
         return
  
       gconf_dir = self.__find_unused_gconf_dir(account.GetType())
@@ -1216,7 +1218,10 @@
         # we should not create a Google account right away because it needs to be verified
         return_cb((None, True, "Please check your e-mail to verify the account."))
       else:
-        account = self.__create_online_account(account_type, username)   
+        account = self.__find_account_in_gconf(account_type, username)
+        _logger.debug("Found account %s " % account) 
+        if not account:
+            account = self.__create_online_account(account_type, username)
         self.__server_accounts.add(account)
         self.__update_account(account) # this will ensure that the account is in gconf, try to find a password for the account, and emit AccountEnabled signal 
         return_cb((account.GetObjectPath(), True, "")) 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]