Commit 7ab212d9 authored by Sigmund Augdal's avatar Sigmund Augdal

Fix fetching more than 500 resources in one go

parent 7bc46cba
......@@ -158,12 +158,18 @@ class Client(object):
collections = self._do_request(url)
return (collection for collection in collections.xpath('/b:service/b:workspace/b:collection/atom:title/text()', namespaces=namespaces))
def query_collection(self, collection, query=None, expand=None, **kw_args):
url = self._format_url(collection, query, kw_args, expand=expand)
collection = self._do_request(url)
def query_collection(self, collection, query=None, expand=None, raw_filter=None, **kw_args):
url = self._format_url(collection, query, kw_args, expand=expand, raw_filter=raw_filter)
result = []
for entry in collection.xpath('/atom:feed/atom:entry', namespaces=namespaces):
result.append(Entry(entry, self))
while url:
collection = self._do_request(url)
for entry in collection.xpath('/atom:feed/atom:entry', namespaces=namespaces):
result.append(Entry(entry, self))
urls = collection.xpath('/atom:feed/atom:link[@rel="next"]/@href', namespaces=namespaces)
if urls:
url = urls[0]
else:
url = None
return result
def get_from_collection(self, collection, subresource=None, **kw_args):
......
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