From: Josh Roesslein Date: Sun, 17 Oct 2010 02:58:56 +0000 (-0500) Subject: Fix a bug in the cache code which would error when loading non-Model objects. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8c900db5aa7b6a226974417a926909fa658472ed;p=tweepy.git Fix a bug in the cache code which would error when loading non-Model objects. --- 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