From 8c900db5aa7b6a226974417a926909fa658472ed Mon Sep 17 00:00:00 2001 From: Josh Roesslein Date: Sat, 16 Oct 2010 21:58:56 -0500 Subject: [PATCH] Fix a bug in the cache code which would error when loading non-Model objects. --- tweepy/binder.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tweepy/binder.py b/tweepy/binder.py index 731ab62..bf2dec3 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -9,6 +9,7 @@ import re from tweepy.error import TweepError from tweepy.utils import convert_to_utf8_str +from tweepy.models import Model re_path_template = re.compile('{\w+}') @@ -114,9 +115,11 @@ def bind_api(**config): # must restore api reference if isinstance(cache_result, list): for result in cache_result: - result._api = self.api + if isinstance(result, Model): + result._api = self.api else: - cache_result._api = self.api + if isinstance(cache_result, Model): + cache_result._api = self.api return cache_result # Continue attempting request until successful -- 2.25.1