Fixed some problems with oauthtwitter

This commit is contained in:
Anna 2010-05-20 20:51:20 -04:00
parent 7877fa2412
commit 9e0e431d4c
2 changed files with 5 additions and 7 deletions

View File

@ -56,7 +56,7 @@ class Hrafn():
self.db = shelve.open(db_file) self.db = shelve.open(db_file)
if not self.db.has_key('tokens'): if not self.db.has_key('tokens'):
self.db['tokens'] = {} self.db['tokens'] = []
if not self.db.has_key('active_page'): if not self.db.has_key('active_page'):
self.db['active_page'] = 0 self.db['active_page'] = 0
@ -540,9 +540,7 @@ class Hrafn():
if token is None: if token is None:
return return
api = apithreads.CustomApi(token) # fixme: need this to work, but need username AFTER we create the API...
username = api.username
if not self.accounts.has_key(username): if not self.accounts.has_key(username):
tokens = self.db['tokens'] tokens = self.db['tokens']
tokens.append(token) tokens.append(token)
@ -551,7 +549,7 @@ class Hrafn():
def add_account(self, token): def add_account(self, token):
api = CustomApi(token) 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)

View File

@ -14,7 +14,7 @@ __author__ = "Hameedullah Khan <hameed@hameedkhan.net>"
__version__ = "0.2" __version__ = "0.2"
from twitter import Api from twitter import Api,NewUserFromJsonDict
from twitter_pb2 import User from twitter_pb2 import User
import simplejson import simplejson
@ -207,5 +207,5 @@ class OAuthApi(Api):
json = self._FetchUrl(url) json = self._FetchUrl(url)
data = simplejson.loads(json) data = simplejson.loads(json)
self._CheckForTwitterError(data) self._CheckForTwitterError(data)
return User.NewFromJsonDict(data) return NewUserFromJsonDict(data)