From 046798d12b7d32de5fb4d4e85bb4e8538b81d728 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Wed, 22 Jul 2009 12:04:14 +0200 Subject: [PATCH] * lpapiwrapper.py: Move isLpTeamMember from LpApiWrapper to PersonTeam where it belongs --- buildd | 2 +- requestsync | 2 +- ubuntutools/lp/lpapiwrapper.py | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/buildd b/buildd index 2dc1e20..8865e29 100755 --- a/buildd +++ b/buildd @@ -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: diff --git a/requestsync b/requestsync index 1f095a7..d0898e5 100755 --- a/requestsync +++ b/requestsync @@ -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() diff --git a/ubuntutools/lp/lpapiwrapper.py b/ubuntutools/lp/lpapiwrapper.py index a27107a..8d3038e 100644 --- a/ubuntutools/lp/lpapiwrapper.py +++ b/ubuntutools/lp/lpapiwrapper.py @@ -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)