[Mailman-Users] View all topics and who's subscribed to them
Mark Sapiro
mark at msapiro.net
Wed May 9 04:00:53 CEST 2012
Kanwar Ranbir Sandhu wrote:
>
>How can I pull out from the cli how many topics are configured in
>mailman, and who's subscribed to them? Do I need to write a script or
>is one available somewhere on the intertubes?
You probably need to create at least a withlist script, but it's pretty
simple. something like
def list_topics(mlist):
if mlist.topics:
print ('List %s has the following topics defined:' %
mlist.real_name)
for name, pattern, desc, emptyflag in mlist.topics:
print ' Topic name: %s; Pattern: %s' % (name, pattern)
print ' Subscribed users:'
for user in mlist.getRegularMemberKeys():
if name in mlist.getMemberTopics(user):
print ' %s' % user
else:
print 'List %s has no topics defined.' % mlist.real_name
This will print a topic followed by the list of users subscribed to it,
followed by the next, etc.
It could easily be rearranged to print all the topics followed by a
list of users and their subscribed topics. E.g., something like:
def list_topics(mlist):
if mlist.topics:
print ('List %s has the following topics defined:' %
mlist.real_name)
for name, pattern, desc, emptyflag in mlist.topics:
print ' Topic name: %s; Pattern: %s' % (name, pattern)
for user in mlist.getRegularMemberKeys():
if mlist.getMemberTopics(user):
print 'User %s is subscribed to' % user
for topic in mlist.getMemberTopics(user):
print ' %s' % topic
else:
print 'List %s has no topics defined.' % mlist.real_name
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users
mailing list