From 0804678ab95c9eb285f820ed651da9c66d61c8dc Mon Sep 17 00:00:00 2001 From: Josh Roesslein Date: Tue, 25 Aug 2009 16:55:49 -0500 Subject: [PATCH] Tutorial fixes. Also fixed issue with binder fetching cached results. --- ROADMAP | 2 +- tutorial/t2.py | 4 ++-- tutorial/t5.py | 2 +- tweepy/binder.py | 7 ++++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ROADMAP b/ROADMAP index 456589d..652dd72 100644 --- a/ROADMAP +++ b/ROADMAP @@ -3,7 +3,6 @@ The plan of attack for the next version of Tweepy. 1.0 -> 1.0.1 ============ + changing profile and background images [DONE] -+ prepare for social graph changes mentioned on mailinglist + finish search api + autodetect authenticated user's ID [DONE] @@ -14,3 +13,4 @@ Future... + command line client example + retweet api [DONE BUT NEEDS TESTING] + async requests ++ prepare for social graph changes mentioned on mailinglist diff --git a/tutorial/t2.py b/tutorial/t2.py index ddc3322..403e72b 100644 --- a/tutorial/t2.py +++ b/tutorial/t2.py @@ -22,7 +22,7 @@ public_timeline = no_auth_api.public_timeline() print 'Public timeline...' for status in public_timeline: print status.text - print 'from: %s' % status.user.screen_name + print 'from: %s' % status.author.screen_name """ Tweepy provides a non-authenticated instance of the API for you already @@ -51,7 +51,7 @@ friends_timeline = auth_api.friends_timeline() print 'Friends timeline...' for status in friends_timeline: print status.text - print 'from: %s' % status.user.screen_name + print 'from: %s' % status.author.screen_name """ The End diff --git a/tutorial/t5.py b/tutorial/t5.py index 4e6a9e1..1e93cc1 100644 --- a/tutorial/t5.py +++ b/tutorial/t5.py @@ -36,7 +36,7 @@ If you wish to use your own cache implementation just extend the Cache interface class (tweepy/cache.py). Then when you create your API instance pass it in. """ -my_api = tweepy.API(cache=MyCache()) +#my_api = tweepy.API(cache=MyCache()) """ The End """ diff --git a/tweepy/binder.py b/tweepy/binder.py index 0c2ce42..cc4d526 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -71,7 +71,12 @@ def bind_api(path, parser, allowed_param=None, method='GET', require_auth=False, cache_result = api.cache.get(url, timeout) if cache_result: # if cache result found and not expired, return it - cache_result._api = api # restore api reference to this api instance + # must restore api reference + if isinstance(cache_result, list): + for result in cache_result: + result._api = api + else: + cache_result._api = api return cache_result # Open connection -- 2.25.1