[Mailman-Users] changing the error html page

Michael Neel neel at mediapulse.com
Fri May 4 20:51:11 CEST 2001


Okay, first understand 2 things - I'm new to mailman and I don't know
python.  That being said, here's what I did...

Mailman seems to not use a template for error pages - not even a global one
(I could be wrong) so I changed the errors to use the subscribe results
template.  Please note - I have removed a lot of choices from the template
pages since I'm dealing with announce lists and some stuff (like digests)
didn't make sense.

Edit the Mailman/Cgi/subscribe.py file (after backing it up!)

Around line 85 or so you see:

        # Go to user options section.
        if not form.has_key("info"):
            doc.AddItem(Header(2, "Error"))
            doc.AddItem(Bold("You must supply your email address."))
            doc.AddItem(mlist.GetMailmanFooter())
            print doc.Format(bgcolor="#ffffff")
            return

        addr = form['info'].value
        member = mlist.FindUser(addr)
        if not member:
            doc.AddItem(Header(2, "Error"))
            doc.AddItem(Bold("%s has no subscribed addr <i>%s</i>."
                             % (mlist.real_name, addr)))
            doc.AddItem(mlist.GetMailmanFooter())
            print doc.Format(bgcolor="#ffffff")
            return

Change it to be:

        # Go to user options section.
        if not form.has_key("info"):
            #doc.AddItem(Header(2, "Error"))
            #doc.AddItem(Bold("You must supply your email address."))
            #doc.AddItem(mlist.GetMailmanFooter())
            #print doc.Format(bgcolor="#ffffff")
            results = 'You must supply your email address.'
            PrintResults(mlist, results, doc)
            return

        addr = form['info'].value
        member = mlist.FindUser(addr)
        if not member:
            #doc.AddItem(Header(2, "Error"))
            #doc.AddItem(Bold("%s has no subscribed addr <i>%s</i>."
            #                 % (mlist.real_name, addr)))
            #doc.AddItem(mlist.GetMailmanFooter())
            #print doc.Format(bgcolor="#ffffff")
            results = "%s has no subscribed addr <i>%s</i>." %
(mlist.real_name, addr)
            PrintResults(mlist, results, doc)
            return

Please not - as I have found out very painfully python likes it's
whitespace!  Be careful when editing (I should get a book on python soon ;)

I hope this helps!

Mike




More information about the Mailman-Users mailing list