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 <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

------------------------------------------------------
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Reply via email to