Merge authors:
  Axel Beckert (xtaran)
Related merge proposals:
  https://code.launchpad.net/~xtaran/mailman/mailman-improvements/+merge/95448
  proposed by: Axel Beckert (xtaran)
  review: Approve - Mark Sapiro (msapiro)
  review: Approve - Bernard (unowned60)
------------------------------------------------------------
revno: 1594 [merge]
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.1
timestamp: Sun 2016-01-17 20:44:26 -0800
message:
  Added options to display (non)moderated members to list_members.
modified:
  NEWS
  bin/list_members


--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1

Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'NEWS'
--- NEWS	2016-01-10 03:33:25 +0000
+++ NEWS	2016-01-18 04:44:26 +0000
@@ -9,6 +9,9 @@
 
   New Features
 
+    - bin/list_members now has options to display all moderated or all
+      non-moderated members.
+
     - There is now a mm_cfg.py setting GLOBAL_BAN_LIST which is like the
       individual list's ban_list but applies globally to all subscribe
       requests.  See the description in Defaults.py for more details.

=== modified file 'bin/list_members'
--- bin/list_members	2005-08-27 01:40:17 +0000
+++ bin/list_members	2016-01-18 04:44:26 +0000
@@ -1,6 +1,6 @@
 #! @PYTHON@
 #
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -48,6 +48,12 @@
         Output member addresses case preserved the way they were added to the
         list.  Otherwise, addresses are printed in all lowercase.
 
+    --moderated / -m
+        Print just the moderated members.  Ignores -r, -d, -n.
+
+    --non-moderated / -M
+        Print just the non-moderated members.  Ignores -r, -d, -n.
+
     --invalid / -i
         Print only the addresses in the membership list that are invalid.
         Ignores -r, -d, -n.
@@ -62,9 +68,8 @@
 
     listname is the name of the mailing list to use.
 
-Note that if neither -r or -d is supplied, both regular members are printed
-first, followed by digest members, but no indication is given as to address
-status.
+Note that if neither -r or -d is supplied, regular members are printed first,
+followed by digest members, but no indication is given as to address status.
 """
 
 import sys
@@ -154,6 +159,8 @@
     fullnames = False
     invalidonly = False
     unicodeonly = False
+    moderatedonly = False
+    nonmoderatedonly = False
 
     # Throw away the first (program) argument
     args = sys.argv[1:]
@@ -200,10 +207,22 @@
                 kind = opt[i+1:]
                 if kind not in ('mime', 'plain'):
                     usage(1, _('Bad --digest option: %(kind)s'))
+        elif opt in ('-m', '--moderated'):
+            moderatedonly = True
+            if nonmoderatedonly or invalidonly or unicodeonly:
+                usage(1, _('Only one of -m, -M, -i or -u may be specified.'))
+        elif opt in ('-M', '--non-moderated'):
+            nonmoderatedonly = True
+            if moderatedonly or invalidonly or unicodeonly:
+                usage(1, _('Only one of -m, -M, -i or -u may be specified.'))
         elif opt in ('-i', '--invalid'):
             invalidonly = True
+            if moderatedonly or nonmoderatedonly or unicodeonly:
+                usage(1, _('Only one of -m, -M, -i or -u may be specified.'))
         elif opt in ('-u', '--unicode'):
             unicodeonly = True
+            if moderatedonly or nonmoderatedonly or invalidonly:
+                usage(1, _('Only one of -m, -M, -i or -u may be specified.'))
         else:
             # No more options left, push the last one back on the list
             args.insert(0, opt)
@@ -241,7 +260,7 @@
         rmembers = mlist.getMemberCPAddresses(rmembers)
         dmembers = mlist.getMemberCPAddresses(dmembers)
 
-    if invalidonly or unicodeonly:
+    if invalidonly or unicodeonly or moderatedonly or nonmoderatedonly:
         all = rmembers + dmembers
         all.sort()
         for addr in all:
@@ -251,6 +270,11 @@
                 showit = True
             if unicodeonly and isunicode(addr):
                 showit = True
+            if moderatedonly and mlist.getMemberOption(addr, mm_cfg.Moderate):
+                showit = True
+            if nonmoderatedonly and not mlist.getMemberOption(addr,
+                                                             mm_cfg.Moderate):
+                showit = True
             if showit:
                 print >> fp, formataddr((safe(name), addr))
         return

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to