[Mailman-Developers] Changing member options via command line
Felix Kipping
felix.kipping at net-develop.de
Sat May 15 03:33:37 EDT 2004
hello,
i have to change the member options (Mail delivery, Set Digest Mode, Get
MIME or Plain Text Digests?, Receive your own posts to the list?, Receive
acknowledgement mail when you send mail to the list?) via the command line.
i figured out that this is possible by using the withlist command and
execute a own python programm.
in the mailman faq i found the following programm to change the member
password via withlist.
---
from Mailman.Errors import NotAMemberError
def changeuserpw(mlist, addr, newpasswd):
try:
mlist.setMemberPassword(addr, newpasswd)
mlist.Save()
except NotAMemberError:
print 'No address matched:', addr
---
i wanted to use this technique to change the above mentiones member options.
i looked into the file /Mailman/Cgi/options.py and found the function call
"setDeliveryStatus(user, newval)". i changed the programm for changing the
password into the following.
---
from Mailman.Errors import NotAMemberError
def changeuseroptions(mlist, email, delivery):
try:
mlist.setDeliveryStatus(email, delivery)
mlist.Save()
except NotAMemberError:
print 'No address matched:', addr
----
but this causes the following error when executing.
---
Traceback (most recent call last):
File "./withlist", line 275, in ?
main()
File "./withlist", line 256, in main
r = do_list(listname, args, func)
File "./withlist", line 189, in do_list
return func(m, *args)
File "./changeuseroptions.py", line 6, in changeuseroptions
mlist.setDeliveryStatus(email, delivery)
File
"/var/tmp/mailman-2.1.1-build/usr/lib/mailman/Mailman/OldStyleMemberships.py
", line 331, in setDeliveryStatus
AssertionError
---
does anybody know what i've done wrong and can give me a hint how i can
write
such a python programm, inorder to change the member options (Mail delivery,
Set Digest Mode, Get MIME or Plain Text Digests?, Receive your own posts to
the list?, Receive acknowledgement mail when you send mail to the list?).
or is there a python programm for download anywhere which accomplishes this
task?
Felix Kipping
More information about the Mailman-Developers
mailing list