* ubuntutools/lp/functions.py:

- Simplify isLPTeamMember.

<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
This commit is contained in:
Anders Kaseorg 2009-05-10 17:41:03 -04:00
parent f25358a175
commit f762242ebb
2 changed files with 5 additions and 15 deletions

4
debian/changelog vendored
View File

@ -30,6 +30,10 @@ ubuntu-dev-tools (0.74) UNRELEASED; urgency=low
- Check if user has upload privileges instead of checking for team - Check if user has upload privileges instead of checking for team
membership when seeing if operations are permitted membership when seeing if operations are permitted
[ Anders Kaseorg ]
* ubuntutools/lp/functions.py:
- Simplify isLPTeamMember.
-- Iain Lane <laney@ubuntu.com> Sun, 10 May 2009 19:13:34 +0100 -- Iain Lane <laney@ubuntu.com> Sun, 10 May 2009 19:13:34 +0100
ubuntu-dev-tools (0.73) karmic; urgency=low ubuntu-dev-tools (0.73) karmic; urgency=low

View File

@ -143,23 +143,9 @@ def isLPTeamMember(team):
If the user is a member of the team: return True. If the user is a member of the team: return True.
If the user is not a member of the team: return False. If the user is not a member of the team: return False.
If the team is not found: raise a TeamNotFoundException.
""" """
try: return any(t.name == team for t in launchpad.me.super_teams)
lpteam = launchpad.people[team]
if not lpteam.is_team:
raise KeyError
return _findMember(lpteam, launchpad.me)
except KeyError:
raise TeamNotFoundException("The team %s does not exist on Launchpad" %
team)
def isPerPackageUploader(package): def isPerPackageUploader(package):
# Checks if the user has upload privileges for a certain package. # Checks if the user has upload privileges for a certain package.