IATI/IATI-Datastore

&stream=True fails for JSON results

Closed this issue · 2 comments

To confirm that the issue isn't the result size, this query returns all of the existing JSON results with &limit=700:

http://datastore.iatistandard.org/api/1/access/activity.json?recipient-country=GN&end-date__gt=2018-01-01&limit=700

The JSON serialiser uses the following wrapper around a query, to make it “quack like a pagination object”:

class Stream(object):
"""
Wrapper to make a query object quack like a pagination object
"""
limit = ''
offset = ''
def __init__(self, query):
self.items = query
self.total = query.count()

However, the query isn’t actually executed, so serialisation fails. I’ve sent a fix (#317).