This looks good. BTW, it is customary to add a comment with the incremental diff of changes. This way the reviewer gets all the changes they need to look at in an email. I've included them below in case anybody else is following the progress on this.
-Edwin
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2010-08-19 14:52:19 +0000
+++ lib/lp/registry/browser/person.py 2010-08-19 17:39:30 +0000
@@ -3101,7 +3101,7 @@
# Membership is via an indirect team so sane defaults exist.
# An indirect member cannot be an Owner or Admin of a team.
role = 'Member'
- # The Person joined, and can't have a join date.
+ # The Person never joined, and can't have a join date. datejoined = None
else:
# The member is a direct member; use the membership data.
@@ -3133,8 +3133,8 @@
paths, memberships = self.context.getPathsToTeams() direct_teams = [membership.team for membership in memberships] indirect_teams = [
- team for team in paths.keys() if
- team not in direct_teams]
+ team for team in paths.keys()
+ if team not in direct_teams] participations = []
# First, create a participation for all direct memberships.
# Get all of the memberships for any of the teams this person is
# a participant of. This must be ordered by date and id because
- # because the graph the results will create needs to contain
+ # because the graph of the results will create needs to contain
# the oldest path information to be consistent with results from
# IPerson.findPathToTeam.
store = Store.of(self)
@@ -2114,7 +2113,7 @@ step = graph[step] path.append(step) paths[team] = path
- return (paths, user_memberships)
+ return (paths, user_memberships)
@property
def teams_participated_in(self):
=== modified file 'lib/lp/registry/tests/test_person.py'
--- lib/lp/registry/tests/test_person.py 2010-08-19 14:48:21 +0000
+++ lib/lp/registry/tests/test_person.py 2010-08-19 17:39:30 +0000
@@ -75,7 +75,7 @@ memberships = [(m.person, m.team) for m in memberships] self.assertEqual([(self.user, self.a_team)], memberships)
Hi JC,
This looks good. BTW, it is customary to add a comment with the incremental diff of changes. This way the reviewer gets all the changes they need to look at in an email. I've included them below in case anybody else is following the progress on this.
-Edwin
=== modified file 'lib/lp/ registry/ browser/ person. py' registry/ browser/ person. py 2010-08-19 14:52:19 +0000 registry/ browser/ person. py 2010-08-19 17:39:30 +0000
datejoine d = None getPathsToTeams ()
direct_ teams = [membership.team for membership in memberships]
indirect_ teams = [
participation s = []
--- lib/lp/
+++ lib/lp/
@@ -3101,7 +3101,7 @@
# Membership is via an indirect team so sane defaults exist.
# An indirect member cannot be an Owner or Admin of a team.
role = 'Member'
- # The Person joined, and can't have a join date.
+ # The Person never joined, and can't have a join date.
else:
# The member is a direct member; use the membership data.
@@ -3133,8 +3133,8 @@
paths, memberships = self.context.
- team for team in paths.keys() if
- team not in direct_teams]
+ team for team in paths.keys()
+ if team not in direct_teams]
# First, create a participation for all direct memberships.
=== modified file 'lib/lp/ registry/ model/person. py' registry/ model/person. py 2010-08-19 17:29:38 +0000 registry/ model/person. py 2010-08-19 17:39:30 +0000 TeamMembership,
And( TeamMembership. personID == self.id, teamID,
TeamMembersh ip.status. is_in(
[TeamMembers hipStatus. APPROVED, TeamMembershipS tatus.ADMIN] )))
--- lib/lp/
+++ lib/lp/
@@ -1712,7 +1712,6 @@
store = Store.of(self)
return store.find(
- Team.id == TeamMembership.
@@ -2080,7 +2079,7 @@
# Get all of the memberships for any of the teams this person is findPathToTeam.
step = graph[step]
path. append( step)
paths[ team] = path
# a participant of. This must be ordered by date and id because
- # because the graph the results will create needs to contain
+ # because the graph of the results will create needs to contain
# the oldest path information to be consistent with results from
# IPerson.
store = Store.of(self)
@@ -2114,7 +2113,7 @@
- return (paths, user_memberships)
+ return (paths, user_memberships)
@property ted_in( self):
def teams_participa
=== modified file 'lib/lp/ registry/ tests/test_ person. py' registry/ tests/test_ person. py 2010-08-19 14:48:21 +0000 registry/ tests/test_ person. py 2010-08-19 17:39:30 +0000
memberships = [(m.person, m.team) for m in memberships]
self. assertEqual( [(self. user, self.a_team)], memberships)
--- lib/lp/
+++ lib/lp/
@@ -75,7 +75,7 @@
- def test_path_ to_team_ no_limit( self): to_team( self): findPathToTeam( self.a_ team) findPathToTeam( self.b_ team) findPathToTeam( self.c_ team)
self. assertEqual( [self.a_ team, self.b_team], path_to_b)
self. assertEqual( [self.a_ team, self.b_team, self.c_team], path_to_c)
+ def test_path_
path_to_a = self.user.
path_to_b = self.user.
path_to_c = self.user.
@@ -84,15 +84,6 @@
- def test_path_ to_team_ with_limit( self): findPathToTeam( self.c_ team, limit=0) findPathToTeam( self.c_ team, limit=1) findPathToTeam( self.c_ team, limit=2) l([self. c_team] , path_to_c_0) l([self. b_team, self.c_team], path_to_c_1) l([self. a_team, self.b_team, self.c_team], path_to_c_2) participated_ in(self) : teams_participa ted_in
self. assertEqual( expected_ paths, paths)
- path_to_c_0 = self.user.
- path_to_c_1 = self.user.
- path_to_c_2 = self.user.
-
- self.assertEqua
- self.assertEqua
- self.assertEqua
-
def test_teams_
teams = self.user.
teams = sorted(list(teams), key=lambda x: x.displayname)
@@ -133,9 +124,9 @@
+ (e_team, self.user),
+ (d_team, self.user),
- (d_team, self.user),
- (e_team, self.user),
]