Person.addMember() does not properly invalidate the person's _inTeam_cache
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Medium
|
Christian Reis |
Bug Description
The following test suite code doesn't work as expected:
>>> team_two = personset.
>>> from canonical.
>>> sabdfl = personset.
>>> team_two.
>>> flush_database_
>>> [team.name for team in salgado.
[u'admins', u'rosetta-admins']
Note that salgado is not an administrator for team_two!
The problem is that Person has a _inTeam_cache that doesn't get invalidated by
Person.addMember(). The alternative is to do this:
>>> from canonical.
>>> salgado.
>>> sabdfl = personset.
>>> team_two.
>>> flush_database_
But this requires that team_two have an OPEN subscription policy. (Extra
dance steps needed if not.)
Person.addMember() should invalidate the _inTeam_cache for the person being
added. Note that .join() is implemented in terms of .addMember() so the
proper fix is probably to move the line:
to .addMember(). I found this too late in the 1.1.7 cycle to feel comfortable
about sneaking the fix in.
Changed in launchpad: | |
importance: | Undecided → Medium |
Changed in launchpad: | |
status: | Fix Committed → Fix Released |
tags: | added: tech-debt |
We probably need to invalidate the cache in setMembershipDa ta(), acceptInvitatio nToBeMemberOf( ) and possibly other methods of IPerson.