Skip to content

Commit

Permalink
a few more fixes so we don't iterate over a million results in one go...
Browse files Browse the repository at this point in the history
  • Loading branch information
nanorepublica committed Dec 8, 2015
1 parent 110662c commit f8b21e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions duedil/search/pro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def next(self):
# update the internal list
if not self.fetched_all_results():
next_set = self.client.get(*self.parse_next_url())
# check the property - this does a .extend()!
self.result_list = next_set
# update the next_url
self.next_url = next_set
Expand Down Expand Up @@ -71,8 +72,8 @@ def __iter__(self):
for result in self.result_list:
yield result
# get the last one and extend the list
if self.result_list[-1] is result:
self.next()
# if self.result_list[-1] is result:
# self.next()


def __contains__(self, result):
Expand All @@ -97,7 +98,7 @@ def _update_next_url(self, limit=None, offset=None):
self._next_url = urlparse.urlunsplit((scheme, netloc, path, urlencode(query_params, doseq=True), frag))

def parse_next_url(self):
parsed_url = urlparse.urlunsplit(self._next_url)
parsed_url = urlparse.urlsplit(self._next_url)
path = parsed_url.path.rsplit('/', 1)[-1] # grab the last part of the path
query_params = dict(urlparse.parsed_qsl(parsed_url.query))
query_params = dict(urlparse.parse_qsl(parsed_url.query))
return path, query_params
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run_tests(self):
sys.exit(errno)


version = '0.6.5'
version = '0.6.6'

setup(name='duedil',
version=version,
Expand Down

0 comments on commit f8b21e4

Please sign in to comment.