Closed Cawb07 closed 8 years ago
@pswaminathan After investigating a related cron error, I'm seeing another case that would be fixed by this:
for campaign in campaigns:
_, count = t1.get('strategies', limit={'campaign': campaign.id}, count=True, page_limit=1)
In cases where the campaign only has one strategy, count == 1
, so not only do we not return a generator for the collection requested, but count is also not returned causing an AttributeError: 0
.
Ah I see. So really what we should do isn't to force an ent_count in any direction, or to check a bunch of different things. What we should really do is to see if the object passed in is an iterator and go from there. I'm playing around with it.
@pswaminathan just fleshed out the "check a bunch of different things" solution. Realized user can still pass count=True
when they're not requesting a collection and that would also cause an AttributeError
.
Sorry—what I'm saying is that I don't like having the check a bunch of things solution. I'm figuring out a way to refactor accordingly.
This is blocking a BSE release.