[Mailman-Users] add_members and email confirmation

Mark Sapiro msapiro at value.net
Fri Oct 28 22:13:43 CEST 2005


Ren Bucholz wrote:
>
>So I created a 
>modified add_members and swapped this line:
>
>> mlist.ApprovedAddMember(userdesc, ack, 0)
>
>with this one:
>
>> mlist.AddMember(userdesc, remote="Webpage")
>
>Running the new script on the command line generates this:
>
>> [me at HOST]$ echo your at email.com | MODIFIED_add_members -r - LISTNAME
>> Traceback (most recent call last):
>>   File "/usr/lib/mailman/bin/MODIFIED_add_members", line 255, in ?
>>     main()
>>   File "/usr/lib/mailman/bin/MODIFIED_add_members", line 235, in main
>>     addall(mlist, nmembers, 0, send_welcome_msg, s)
>>   File "/usr/lib/mailman/bin/MODIFIED_add_members", line 135, in addall
>>     mlist.AddMember(userdesc, remote="Webpage")
>>   File "/usr/lib/mailman/Mailman/MailList.py", line 888, in AddMember
>>     raise Errors.MMSubscribeNeedsConfirmation
>> MMSubscribeNeedsConfirmation
>
>Strangest of all, a confirmation message *is* generated and sent to the 
>email address, but clicking on the confirmation link just sends me to a 
>MM error page.  I'm at a loss as to what the problem might be.


The problem is that AddMember generates the pending subscription, the
cookie and the confirmation email and then raises
Errors.MMSubscribeNeedsConfirmation so the caller (generally,
Mailman/Cgi/subscribe.py) can catch the exception and generate the
appropriate response text. The add_members script doesn't catch this
exception, so you get the above error. You can just add

        except Errors.MMSubscribeNeedsConfirmation:
            print >> tee, _('Sent Confirmation: %(member)s')

or maybe, if you don't actually see this output, just

        except Errors.MMSubscribeNeedsConfirmation:
            pass

to the excepts following the try: of the AddMember call. You probably
want to also handle the Errors.MMNeedApproval exception in case you do
this on a list where subscription requires approval.

As to why the confirmation link returned an error, I don't know why
this happened. What does Mailman's error log say?

-- 
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan




More information about the Mailman-Users mailing list