Collection returned by getBugSubscriberPackages() via LP API claims to have elements, but they aren't accessible.

Bug #968952 reported by Jussi Pakkanen on 2012-03-30
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
launchpadlib
High
Unassigned

Bug Description

I can iterate over collections returned by launchpadlib, but not those returned by user.getBugSubscriberPackages. The result claims to hold 10 elements, but iterating over it produces nothing. Here is a sample script:

-----

#!/usr/bin/python -tt

from launchpadlib.launchpad import Launchpad

cachedir = "~/.launchpadlib/cache/"
launchpad = Launchpad.login_anonymously('subscriber-bug', 'production', cachedir)

user = launchpad.people['utouch-bugs']
packages = user.getBugSubscriberPackages()
total_size = packages.total_size # len(packages) gives the same value.
assert(total_size > 0)
iter_size = 0
for p in packages:
    iter_size += 1

if iter_size != total_size:
    print 'Iteration does not work. Total_size is', total_size, ', but iterated size is', iter_size
else:
    print "Iteration works."

------

What should happen:

It prints "Iteration works.".

What happens instead:

It prints "Iteration does not work. Total_size is 10 , but iterated size is 0".

Tags: api Edit Tag help
Graham Binns (gmb) on 2012-03-30
summary: - Iterating over results from getBugSubscriberPackages does not work
+ Collection returned by getBugSubscriberPackages() via LP API claims to
+ have elements, but they aren't accessible.
Changed in launchpadlib:
status: New → Triaged
importance: Undecided → High
tags: added: api
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers