On Jun 11, 2004, at 07:33, Christopher Adams wrote:

Is there a way, other than using the subscriber user page to subsribe subscribers to specific topics?. I have a list of about 1000 subscribers that I would like to break out into 5 topics. I don't want to rely on the subscribers to have to do this. So, any ideas on how to do this in batch via one of the provided MM utilities or other methods?

You can do this sort of thing with bin/withlist, taking advantage of the documentation that is embedded in Mailman/MemberAdaptor.py.


Create a file called addtopic.py:

from Mailman.Errors import NotAMemberError
from Mailman import mm_cfg
import sys

def addtopic(m, addr, topic):
try:
if topic not in [x[0] for x in m.topics]:
print topic, "is not a valid topic for list"
sys.exit(2)
topic_list = m.getMemberTopics(addr)
# add the topic for this member if not already subscribed
if topic not in topic_list:
m.setMemberTopics(addr, topic_list + [topic])
# set subscriber to not receive non-topical posts
m.setMemberOption(addr, mm_cfg.ReceiveNonmatchingTopics, mm_cfg.No)
m.Save()
except NotAMemberError:
print 'No address matched:', addr


Then to have a user on "mylist" watch the "pickles" topic:

$ bin/withlist -l -r addtopic mylist [EMAIL PROTECTED] pickles

bin/withlist gives you the full power of Python to play with, so you could replace 'topic' with a variable number of arguments (so you could subscribe the user to multiple topics at once), or replace their topics instead of appending to them, or loop through a file of users to set them all in one go (instead of doing the looping at the shell level), or whatever...



--
Jim Tittsler             http://www.OnJapan.net/      GPG: 0x01159DB6
Python Starship          http://Starship.Python.net/
Ringo MUG Tokyo          http://www.ringo.net/rss.html


------------------------------------------------------ Mailman-Users mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/

Reply via email to