[Mailman-Users] Using topics vs. Additional Lists
Jim Tittsler
jwt at OnJapan.net
Fri Jun 25 06:36:00 CEST 2004
On Wed, Jun 23, 2004 at 03:43:24PM -0500, Joe Burkhart wrote:
> But, it would be very helpful to be able to query for a list of all members
> subscribed to a particular topic from the command line or elsewhere. Is
> that possible?
Similar to the addtopic.py tool I posted on Jun 11th, but doing
get instead of set. topic_subscribers.py
import sys
from Mailman import mm_cfg
def topic_subscribers(m, topic):
if not m.topics_enabled:
print "topics aren't enabled for list", m.real_name
sys.exit(2)
if topic not in [x[0] for x in m.topics]:
print topic, "is not a valid topic for list", m.real_name
sys.exit(2)
for member in m.members:
if topic in m.getMemberTopics(member):
# flag users that get messages other than topics
if m.getMemberOption(member, mm_cfg.ReceiveNonmatchingTopics):
print member, "+"
else:
print member
else:
# if not subscribed to the topic, but receiving non matching
# messages
if m.getMemberOption(member, mm_cfg.ReceiveNonmatchingTopics):
print member, "*"
$ bin/withlist -r topic_subscribers mylist fish
would then list everyone subscribed to the 'fish' topic of 'mylist'
(as well as people that receive messages for any topic).
--
Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6
Python Starship http://Starship.Python.net/
Ringo MUG Tokyo http://www.ringo.net/rss.html
More information about the Mailman-Users
mailing list