Changing member options via command line

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

On May 15, 2004, at 16:33, Felix Kipping wrote:
File "/var/tmp/mailman-2.1.1-build/usr/lib/mailman/Mailman/ OldStyleMemberships.py ", line 331, in setDeliveryStatus AssertionError
I no longer have Mailman 2.1.1 around to check. Which assertion is on
line 331?
Did you remember to lock the list when invoking withlist?
Are you sure the value you are using for 'delivery' is one of the
allowed values?
MemberAdaptor.ENABLED, MemberAdaptor.UNKNOWN,
MemberAdaptor.BYUSER, MemberAdaptor.BYADMIN,
MemberAdaptor.BYBOUNCE
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?).
I posted a similar code fragment on mailman-users on May 7th for
dealing with delivery. For other user options, check the
getMemberOption() and setMemberOption() functions of MemberAdaptor.
-- Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6 Python Starship http://Starship.Python.net/ Ringo MUG Tokyo http://www.ringo.net/rss.html
participants (2)
-
Felix Kipping
-
Jim Tittsler