[Mailman-Users] add_members and email confirmation

Mark Sapiro msapiro at value.net
Sat Dec 10 20:43:20 CET 2005


Ren Bucholz wrote:
>
>I'm still having a problem with the confirmations, however.  To recap, 
>I'm trying to use a modified version of add_members (call it 
>new_add_members) in order to subscribe people via my own webform (where 
>PHP executes add_members).  I modified it because I'd like the list to 
>be confirmed opt-in, but add_members assumes that the user has 
>confirmed their subscription and doesn't bother with the confirmation 
>message. There's a longer description of what I did in this list's 
>archives, if you're interested:
>   http://www.mail-archive.com/mailman-users@python.org/msg35077.html
>
>The problem is that this script totally breaks Mailman's web 
>subscription features.  The first time I run new_add_members, I get a 
>seemingly normal looking confirmation.  Upon clicking the confirmation 
>link, I get the Mailman's generic "Sorry, We Hit A Bug!" message.  And 
>from that point forward, attempting to subscribe via the list's 
>standard Mailman info page (foo.com/mailman/listinfo/your_list) 
>generates the same error.  You can still subscribe by calling the 
>unmodified add_members.  The error logs say:
>
>admin(32487): [----- Mailman Version: 2.1.5 -----]
>admin(32487): [----- Traceback ------]
>admin(32487): Traceback (most recent call last):
>admin(32487):   File "/usr/lib/mailman/scripts/driver", line 101, in 
>run_main
>admin(32487):     main()
>admin(32487):   File "/usr/lib/mailman/Mailman/Cgi/subscribe.py", line 
>96, in main
>admin(32487):     process_form(mlist, doc, cgidata, language)
>admin(32487):   File "/usr/lib/mailman/Mailman/Cgi/subscribe.py", line 
>176, in process_form
>admin(32487):     mlist.AddMember(userdesc, remote)
>admin(32487):   File "/usr/lib/mailman/Mailman/MailList.py", line 854, 
>in AddMember
>admin(32487):     cookie = self.pend_new(Pending.SUBSCRIPTION, userdesc)
>admin(32487):   File "/usr/lib/mailman/Mailman/Pending.py", line 65, in 
>pend_new
>admin(32487):     db = self.__load()
>admin(32487):   File "/usr/lib/mailman/Mailman/Pending.py", line 95, in 
>__load
>admin(32487):     return cPickle.load(fp)
>admin(32487): AttributeError: 'module' object has no attribute 
>'UserDesc'
<snip>

>If anyone has any idea how to fix this, I'd be most appreciative.  I 
>should also mention that error isn't limited to a single address - 
>subscribing me at fake.com via new_add_members will cause a web 
>subscription for you at fake.com to fail. Thanks for reading this far!


At this point, lists/listname/pending.pck is corrupt and has to be
removed for normal stuff to proceed.

The underlying problem is new_members defines the UserDesc class to be
empty, thus when you call

mlist.AddMember(userdesc, remote="Webpage")

userdesc is not a valid UserDesc instance for AddMember which is where
things go wrong.

I think you need to do the following in your script.

Add

from Mailman.UserDesc import UserDesc

Remove

class UserDesc: pass

It looks like that's all you need, but I haven't looked too thoroughly.

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