changed cursor() from recursion to while loop #284

Merged
drevicko merged 2 commits from non-recursive-cursor into master 2014-02-25 12:36:58 -08:00
Showing only changes of commit 32337fd036 - Show all commits

View file

@ -408,6 +408,7 @@ class Twython(EndpointsMixin, object):
if not hasattr(function, 'iter_mode'): if not hasattr(function, 'iter_mode'):
raise TwythonError('Unable to create generator for Twython method "%s"' % function.__name__) raise TwythonError('Unable to create generator for Twython method "%s"' % function.__name__)
while True:
content = function(**params) content = function(**params)
if not content: if not content:
@ -438,9 +439,6 @@ class Twython(EndpointsMixin, object):
except (TypeError, ValueError): # pragma: no cover except (TypeError, ValueError): # pragma: no cover
raise TwythonError('Unable to generate next page of search results, `page` is not a number.') raise TwythonError('Unable to generate next page of search results, `page` is not a number.')
for result in self.cursor(function, **params):
yield result
@staticmethod @staticmethod
def unicode2utf8(text): def unicode2utf8(text):
try: try: