More fixes to the add_account function. Now we produce a 400 error on GetUserInfo

This commit is contained in:
Anna 2010-05-20 21:23:54 -04:00
parent 9e0e431d4c
commit 5768f0e91c

View File

@ -67,7 +67,8 @@ class Hrafn():
# Now set up the accounts and their corresponding APIs
self.accounts = {}
for token in self.db['tokens']:
self.add_account(token)
api = apithreads.CustomApi(token)
self.add_account(api)
if not self.db.has_key('active_user'):
try:
@ -75,7 +76,6 @@ class Hrafn():
except IndexError:
self.db['active_user'] = None
self.username = self.db['active_user']
try:
@ -83,7 +83,6 @@ class Hrafn():
except KeyError:
self.api = None
if not self.db.has_key('open_tabs'):
self.db['open_tabs'] = []
@ -540,16 +539,16 @@ class Hrafn():
if token is None:
return
# fixme: need this to work, but need username AFTER we create the API...
if not self.accounts.has_key(username):
api = apithreads.CustomApi(token)
if not self.accounts.has_key(api.username):
tokens = self.db['tokens']
tokens.append(token)
self.db['tokens'] = tokens
self.add_account(token)
self.add_account(api)
def add_account(self, token):
api = apithreads.CustomApi(token)
def add_account(self, api):
username = api.username
self.accounts[username] = api
self.accounts[username].sig_proxy.connect('lists-ready', self.on_lists_ready)
@ -564,14 +563,9 @@ class Hrafn():
if username == self.username:
menu_item.set_active(True)
if first_item is None:
first_item = menu_item
menu_item.connect('activate', self.on_account_changed, name)
self.accounts_menu.append(menu_item)
menu_item.show()
menu_item.connect('activate', self.on_account_changed, username)
self.accounts_menu.append(menu_item)
menu_item.show()
### end class Hrafn