[Mailman-Users] Changing HTML templates

Richard Barrett r.barrett at openinfo.co.uk
Sat Jun 26 22:10:11 CEST 2004

On 26 Jun 2004, at 18:13, Nathan Kennedy wrote:

> Hello,
> I am running Mailman 2.1.x on OpenBSD 3.5.  I wanted to customize the 
> Mailman HTML, in particular the archive login page and the mail 
> archives, to match the rest of my website.  Through the admin 
> interface, I found that there were only three pages that I could edit, 
> so I edited the HTML templates directly in 
> /usr/local/lib/mailman/templates/en/.  Then I did arch --wipe 
> listname, and the changes to the archive HTML took effect and looked 
> nice.
> However, I was bewildered that the next time mail was sent to the 
> list, the archive index was rebuilt using the default, original 
> Mailman HTML.  Again I did arch --wipe listname, and my changes took 
> effect.
> Why is it that when mail is sent to the list, it is not using the 
> templates in mailman/templates/en, and where IS it getting the 
> templates from?  It doesn't look like the templates are embedded in 
> the list configuration, at least I could not find them there.  Seems 
> odd that arch --wipe listname would have different behavior from how 
> Mailman normally rebuilds the archive HTML when it gets mail.

Asked and answered in this posting to the list on 17th June 2004


btw: as you have modified the templates in 
/usr/local/lib/mailman/templates/en/ you will lose those changes when 
you next upgrade Mailman. You should put your site and list specific 
changes as described in these comments form $prefix/Mailman/Utils.py:

def findtext(templatefile, dict=None, raw=False, lang=None, mlist=None):
     # Make some text from a template file.  The order of searches 
depends on
     # whether mlist and lang are provided.  Once the templatefile is 
     # string substitution is performed by interpolation in `dict'.  If 
     # is false, the resulting text is wrapped/filled by calling wrap().
     # When looking for a template in a specific language, there are 4 
     # that are searched, in this order:
     # 1. the list-specific language directory
     #    lists/<listname>/<language>
     # 2. the domain-specific language directory
     #    templates/<list.host_name>/<language>
     # 3. the site-wide language directory
     #    templates/site/<language>
     # 4. the global default language directory
     #    templates/<language>
     # The first match found stops the search.  In this way, you can 
     # templates at the desired level, or, if you use only the default
     # templates, you don't need to change anything.  You should never 
     # files in the templates/<language> subdirectory, since Mailman will
     # overwrite these when you upgrade.  That's what the templates/site
     # language directories are for.
     # A further complication is that the language to search for is 
     # by both the `lang' and `mlist' arguments.  The search order there 
     # that if lang is given, then the 4 locations above are searched,
     # substituting lang for <language>.  If no match is found, and 
mlist is
     # given, then the 4 locations are searched using the list's 
     # language.  After that, the server default language is used for
     # <language>.  If that still doesn't yield a template, then the 
     # distribution's English language template is used as an ultimate
     # fallback.  If that's missing you've got big problems. ;)

> -Nathan
> ------------------------------------------------------
> Mailman-Users mailing list
> Mailman-Users at python.org
> http://mail.python.org/mailman/listinfo/mailman-users
> Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
> Searchable Archives: 
> http://www.mail-archive.com/mailman-users%40python.org/

More information about the Mailman-Users mailing list