Thanks for your reply. As an experiment, I tried doing just as you said. I created a file named addtopics.py in the /lists/Mailman directory. From the command line, I issued the command: ./withlist -l -r addtopic testlist [EMAIL PROTECTED] Licensing

The result follow:

Importing addtopic...
Traceback (most recent call last):
 File "./withlist", line 275, in ?
   main()
 File "./withlist", line 247, in main
   mod = __import__(module)
ImportError: No module named addtopic


What have I missed?

Jim Tittsler wrote:

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...




-- Christopher Adams Library Systems Analyst Oregon State Library 503-378-4243 258 [EMAIL PROTECTED]




------------------------------------------------------ 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