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