[Mailman-Users] Customization

Ron Brogden rb at islandnet.com
Mon Jun 3 19:13:01 CEST 2002


On June 1, 2002 08:48 pm, mike at net3media.com wrote:
> I'm trying to make error pages and list view pages custom to the design of
> my site.
> The individual list pages are complete, but...
> Has anyone had any luck with this, or can anyone point me in the right
> direction?

I have successfully modded (if you can call my little tiny hack that) Mailman 
to use a custom error page and it was actually pretty simple.  

In "mailman/Cgi/edithtml.py":

def main():
    template_data = (
        ('listinfo.html',    'General list information page'),
        ('subscribe.html',   'Subscribe results page'),
        ('options.html',     'User specific options page'),
        ('handle_opts.html', 'Changing user options results page'),
        ('errors.html', 'Error Page'),
        )

Add the above "errors.html" line.  

In "mailman/Cgi/subscribe.py" add the following function:

def PrintErrorResults(mlist, results, doc):
    replacements = mlist.GetStandardReplacements()
    replacements['<mm-results>'] = results
    output = mlist.ParseTags('errors.html', replacements)
    doc.AddItem(output)
    print doc.Format(bgcolor="#ffffff")

Then it is just a matter of going through the spots in the above directory 
that can cause an error page to display, such as the following in 
"subscribe.py":

if not form.has_key("info"):
            #doc.AddItem(Header(2, "Error"))
            results = ("<b>You must supply your email address</b>.")
            #doc.AddItem(Bold("You must supply your email address."))
            #doc.AddItem(mlist.GetMailmanFooter())
            #print doc.Format(bgcolor="#ffffff")
            PrintErrorResults(mlist, results, doc)  <<< NEW
             return

Comment out the lines that send text to the doc object (i.e. print out right 
away) and instead use the new PrintErrorResults() function.

I can't perform a diff for you as I do not have a pristine copy of the source 
to work from but hopefully that is enough to get you started.

Cheers

-- 
-----------------------------------------------------------------------------
Island Net AMT Solutions Group Inc.          Telephone:          250 383-0096
1412 Quadra Street                           Toll Free:        1 800 331-3055
Victoria, B.C.                               Fax:                250 383-6698
V8W 2L1                                      E-Mail:    support at islandnet.com
Canada                                       WWW:   http://www.islandnet.com/
-----------------------------------------------------------------------------





More information about the Mailman-Users mailing list