The methods __iter__() and __len__() of several person-related vocabularies are broken

Bug #583502 reported by Abel Deuring
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Unassigned

Bug Description

Running this script:

from zope.schema.vocabulary import getVocabularyRegistry
from lp.registry.interfaces.person import IPersonSet

vocabulary_registry = getVocabularyRegistry()
team = getUtility(IPersonSet).getByName('hwdb-team')
team_vocab = vocabulary_registry.get(team, 'ValidTeamMember')
print len(team_vocab)

members_from_vocab = [term.value for term in team_vocab]
unreal_members = [person for person in members_from_vocab
                if not person.inTeam(team)]

print len(unreal_members)

in bin/iharness gives this output:

98
81

__iter__() returns every record of the table Person, and __len__() returns the number of these records. It seems that the class attribute _filter is missing.

Revision history for this message
Curtis Hovey (sinzui) wrote :

We definitely want this fixed when we work on private teams again.

Changed in launchpad-registry:
status: New → Triaged
importance: Undecided → Low
milestone: none → series-future
Curtis Hovey (sinzui)
tags: added: tech-debt
Curtis Hovey (sinzui)
tags: added: disclosure
tags: added: vocabulary
Curtis Hovey (sinzui)
tags: added: person-picker
Revision history for this message
Curtis Hovey (sinzui) wrote :

I am removing part the 17/18 count issue. This is not a code issue. Sample data has a row for a deactivated user. The vocab and team report the same information when the data is fixed.

description: updated
Revision history for this message
Curtis Hovey (sinzui) wrote :

Recent changes to membership counting fixed this issue in the vocab. The only surprise in the numbers is that sample data has a TP row for a deactivated user.

description: updated
Changed in launchpad:
status: Triaged → Fix Released
Curtis Hovey (sinzui)
Changed in launchpad:
assignee: nobody → Curtis Hovey (sinzui)
Curtis Hovey (sinzui)
Changed in launchpad:
assignee: Curtis Hovey (sinzui) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.