Merge lp:~mbp/lptools/remove-members into lp:lptools

Proposed by Martin Pool
Status: Merged
Merged at revision: 16
Proposed branch: lp:~mbp/lptools/remove-members
Merge into: lp:lptools
Diff against target: 53 lines (+49/-0)
1 file modified
bin/lp-remove-team-members (+49/-0)
To merge this branch: bzr merge lp:~mbp/lptools/remove-members
Reviewer Review Type Date Requested Status
lptools Hackers Pending
Review via email: mp+48435@code.launchpad.net

Description of the change

Add an lp-remove-team-members script

(Arguably should be lp-set-member-status to be more general.)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'bin/lp-remove-team-members'
2--- bin/lp-remove-team-members 1970-01-01 00:00:00 +0000
3+++ bin/lp-remove-team-members 2011-02-03 06:42:52 +0000
4@@ -0,0 +1,49 @@
5+#!/usr/bin/python
6+#
7+# Copyright 2011 Canonical Ltd.
8+#
9+# This program is free software: you can redistribute it and/or modify it
10+# under the terms of the GNU General Public License version 3, as published
11+# by the Free Software Foundation.
12+#
13+# This program is distributed in the hope that it will be useful, but
14+# WITHOUT ANY WARRANTY; without even the implied warranties of
15+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
16+# PURPOSE. See the GNU General Public License for more details.
17+#
18+# You should have received a copy of the GNU General Public License along
19+# with this program. If not, see <http://www.gnu.org/licenses/>.
20+
21+"""Remove members from a Launchpad team.
22+
23+Usage: lp-remove-team-members TEAM MEMBER...
24+"""
25+
26+import socket
27+import sys
28+
29+from lptools.config import (
30+ get_launchpad)
31+
32+
33+def main(args):
34+ if len(args) < 3:
35+ print __doc__
36+ return 1
37+ lp = get_launchpad('lptools on %s' % (socket.gethostname(),))
38+ team_name = args[1]
39+ team = lp.people[team_name]
40+ members_details = team.members_details
41+ for exile_name in args[2:]:
42+ print 'remove %s from %s...' % (exile_name, team_name),
43+ for m in members_details:
44+ if m.member.name == exile_name:
45+ m.setStatus(status='Deactivated')
46+ print 'done'
47+ break
48+ else:
49+ print 'not a member?'
50+
51+
52+if __name__ == '__main__':
53+ sys.exit(main(sys.argv))

Subscribers

People subscribed via source and target branches