Commit 8c900db5 authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Fix a bug in the cache code which would error when loading non-Model objects.

parent 68c74580
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment