Merge lp://qastaging/~andersk/ubuntu-dev-tools/isLPTeamMember into lp://qastaging/~ubuntu-dev/ubuntu-dev-tools/trunk

Proposed by Anders Kaseorg
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~andersk/ubuntu-dev-tools/isLPTeamMember
Merge into: lp://qastaging/~ubuntu-dev/ubuntu-dev-tools/trunk
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~andersk/ubuntu-dev-tools/isLPTeamMember
Reviewer Review Type Date Requested Status
Ubuntu Development Team Pending
Review via email: mp+6395@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Anders Kaseorg (andersk) wrote :

<Laney> andersk: what does super_teams do?
<andersk> Laney: I found super_teams using dir(launchpad.me). It
returns the collection of teams that the person is a member of. I'm
not sure it's actually documented.
<Laney> andersk: I've found the documentation to be a bit
lacking. Does it count indirect memberships too?
<andersk> Laney: yes, it appears to.
<Laney> andersk: If that's right then your version is better than mine
<Laney> andersk: Could you prepare a branch for merging? I'd just do
it directly but I'm a bit busy now so can't, and I'm afraid I'll
forget

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2009-05-10 18:14:43 +0000
3+++ debian/changelog 2009-05-10 21:41:03 +0000
4@@ -30,6 +30,10 @@
5 - Check if user has upload privileges instead of checking for team
6 membership when seeing if operations are permitted
7
8+ [ Anders Kaseorg ]
9+ * ubuntutools/lp/functions.py:
10+ - Simplify isLPTeamMember.
11+
12 -- Iain Lane <laney@ubuntu.com> Sun, 10 May 2009 19:13:34 +0100
13
14 ubuntu-dev-tools (0.73) karmic; urgency=low
15
16=== modified file 'ubuntutools/lp/functions.py'
17--- ubuntutools/lp/functions.py 2009-05-09 20:08:46 +0000
18+++ ubuntutools/lp/functions.py 2009-05-10 21:41:03 +0000
19@@ -143,23 +143,9 @@
20
21 If the user is a member of the team: return True.
22 If the user is not a member of the team: return False.
23-
24- If the team is not found: raise a TeamNotFoundException.
25 """
26
27- try:
28-
29- lpteam = launchpad.people[team]
30-
31- if not lpteam.is_team:
32- raise KeyError
33-
34- return _findMember(lpteam, launchpad.me)
35-
36- except KeyError:
37-
38- raise TeamNotFoundException("The team %s does not exist on Launchpad" %
39- team)
40+ return any(t.name == team for t in launchpad.me.super_teams)
41
42 def isPerPackageUploader(package):
43 # Checks if the user has upload privileges for a certain package.