* lpapiwrapper.py:

Move isLpTeamMember from LpApiWrapper to PersonTeam where it belongs
This commit is contained in:
Michael Bienia 2009-07-22 12:04:14 +02:00
parent d63b782aec
commit 046798d12b
3 changed files with 10 additions and 11 deletions

2
buildd
View File

@ -122,7 +122,7 @@ component = sources.getComponent()
# Operations that are remaining may only be done by Ubuntu developers (retry)
# or buildd admins (rescore). Check if the proper permissions are in place.
if op == "rescore": necessaryPrivs = lpapiwrapper.isLpTeamMember('launchpad-buildd-admins')
if op == "rescore": necessaryPrivs = lpapiwrapper.getMe().isLpTeamMember('launchpad-buildd-admins')
if op == "retry": necessaryPrivs = lpapiwrapper.canUploadPackage(package, release)
if op in ('rescore', 'retry') and not necessaryPrivs:

View File

@ -363,7 +363,7 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext):
#newly created bugreports have one task
task = bug.bug_tasks[0]
# Only members of ubuntu-bugcontrol can set importance
if LpApiWrapper.isLpTeamMember('ubuntu-bugcontrol'):
if LpApiWrapper.getMe().isLpTeamMember('ubuntu-bugcontrol'):
task.importance = 'Wishlist'
task.status = status
task.lp_save()

View File

@ -221,15 +221,6 @@ class LpApiWrapper(object):
return cls.canUploadPackage(package, series) and pkg in cls._upload_pkg
@classmethod
def isLpTeamMember(cls, team):
'''
Checks if the user is a member of a certain team on Launchpad.
Returns True if the user is a member of the team otherwise False.
'''
return any(t.name == team for t in cls.getMe().super_teams)
class MetaWrapper(type):
'''
@ -373,3 +364,11 @@ class PersonTeam(BaseWrapper):
if not cached:
cached = PersonTeam(Launchpad.people[person_or_team])
return cached
def isLpTeamMember(self, team):
'''
Checks if the user is a member of a certain team on Launchpad.
Returns True if the user is a member of the team otherwise False.
'''
return any(t.name == team for t in self.super_teams)