[Mailman-Users] Re: Templates

Richard Barrett r.barrett at openinfo.co.uk
Wed Jul 2 12:42:22 CEST 2003


At 08:59 02/07/2003, Timothy Arnold wrote:
>Hi Richard,
>
>I have edited most of the template files in template/en (for our English 
>mailing lists). They all work fine. I have even edited the header.html & 
>footer.html for ht://Dig (btw, is there any way to configure the mailman 
>integration to change the mailinglist.conf file to point header & footer 
>to the lists search directory instead of $COMMON?)

You have a couple of options:

1. The per-list htdig.conf template is $prefix/templates/en/htdig_conf.txt. 
The same acquisition inheritance applies for it as for the other MM 2.1.2 
template files.

2. You can define a value for the MM config variable HTDIG_EXTRAS in 
$prefix/Mailman/mm_cfg.py. See $prefix/Mailman/Defaults.py to notes on the 
variable.

Using either of these two approaches you can assign values Htdig 
configuration file variables such as search_results_header and 
search_results_footer in the per-list htdig.conf template. See 
http://htdig.org/attrs.html or http://htdig.org/confindex.html for more info.

If you wanted per-list and per-virtual-host header.html and footer.html 
then you would probably want to use Option 1 above. Option 2 is equivalent 
to the site templates and is, with MM 2.1.x, no longer strictly necessary. 
It was introduced when the htdig integration patch was initiall developed 
for use with MM 2.0.x (templates embedded in the source code then) and I 
have left it in place for compatibility with sites updating from MM 2.0.x

>The only pages left to edit are the listinfo page for the 'lists of 
>lists', the subscriber options page, and the admin interface. I cannot 
>figure out what template files these are generated by. I looked in 
>listinfo.py and could not find any reference to html code at all!

These pages represent a different problem as they are created dynamically 
by the various MM CGI scripts. These scripts create instances of HTML'ish 
objects. Having assembled these object to create an object representation 
of the page, a recursive call to Format() functions on each of the classes 
is used to generate the HTML version of the page. There is thus a 
reasonable separation between content and rendering.

The good news is that this HTML generation is concentrated in the class 
definitions in the file $prefix/Mailman/htmlformat.py

The bad news is you have to read and modify some Python if you want to 
change things.

But attacking htmlformat.py will give you leverage over the HTML output 
being generated using this approach by the following MM CGI scripts: 
admin.py, admindb.py, confirm.py, create.py, edithtml.py, listinfo.py, 
options.py, private.py, rmlist.py, roster.py, subscribe.py

Take a look at the Python source in htmlformat.py. It is really quite man 
readable. I do not know how much programming experience you have but if it 
is limited then "Learning Python" by Lutz and Ascher (pub O'Reilly) covers 
more than enough ground for making the changes you need to htmlformat.py; 
your examples show you have the HTML end of things hacked. Once you have 
adapted to using indentation instead of braces for block structure you will 
find Python is a very clean syntax to use. Also, the ability to run python 
interpreter interactively can really speed development work up.

If you want any support on this get back to me off list.

>An example: http://lists.becta.org.uk/mailman/listinfo/mailman works fine, 
>all nice and branded but if you go to 
>http://lists.becta.org.uk/mailman/listinfo, it is not branded. How do I 
>make the lists of lists look like every other part of the site?
>
>Thanks for your help.
>
>Timothy
>
>-----Original Message-----
>From: Richard Barrett [mailto:r.barrett at openinfo.co.uk]
>Sent: 01 July 2003 19:01
>To: Timothy Arnold
>Cc: mailman-users at python.org
>Subject: RE: [Mailman-Users] Re: Templates
>
>
>At 18:27 01/07/2003, Timothy Arnold wrote:
> >That's what I thought... Anyone recommend a good python book? >:)
> >
> >I presume this is the same for the subscriber options? I am trying to
> >make
> >as much of the mailman interface that the end user (subscriber) sees 
> Becta >branded as possible.
>
>If you are using MM 2.1.2 then you will find a much of the html has been
>abstracted to the $prefix/templates directory language subdirectories and 
>their brethren.
>
>Although pages are being generated by MM scripts these now tend to 
>populate template files rather than generate HTML from scratch.
>
>You can set up/change these templates by language as follows (from the
>comments in $prefix/Mailman/Utils.py):
>
><quote>
>      # When looking for a template in a specific language, there are 4 places
>      # 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 
> specialize
>      # templates at the desired level, or, if you use only the default
>      # templates, you don't need to change anything.  You should never modify
>      # files in the templates/<language> subdirectory, since Mailman will
>      # overwrite these when you upgrade.  That's what the templates/site
>      # language directories are for.
></quote>
>
>Take a look at these template files and evaluate the template search
>hierarchy before concluding that hacking the Python code is the only way
>forward.
>
> >Thanks,
> >Timothy
> >
> >-----Original Message-----
> >From: Paul H Byerly [mailto:paul at thcwd.com]
> >Sent: 01 July 2003 16:56
> >To: mailman-users at python.org
> >Subject: [Mailman-Users] Re: Templates
> >
> >
> >       That is what I get for answering a question when I should not
> >yet
> > be awake.  I belive that page is generated by a cgi script
> >(mailman/cgi-bin/listinfo), which is going to make editing a real problem.
> >
> >At 09:37 AM 7/1/2003, you wrote:
> > >That edits the listinfo for the list, not the list of lists...
> > >
> > >Thanks,
> > >Timothy.
> > >
> > >-----Original Message-----
> > >From: Paul H Byerly [mailto:paul at thcwd.com]
> > >Sent: 01 July 2003 15:07
> > >To: mailman-users at python.org
> > >Subject: [Mailman-Users] Re: Templates
> > >
> > >
> > >"Timothy Arnold" wrote:
> > > >The problem I am having at the moment is trying to figure out how
> > > >to edit the main listinfo page
> > > >mailman.becta.org.uk/mailman/listinfo and the
> > > end >user subscription page. We would like to make the site as
> > > branded as
> > > >possible (except for admin interface). Does anyone know how to
> > > >achieve this?
> > >
> > >       From the admin page click "Edit public HTML pages on the right
> > > side a little above the Logout link.
> > >
> > >
> > ><>< Paul
> >
> ><>< Paul
> >
> >
> >------------------------------------------------------
> >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/
> >
> >This message was sent to: timothy.arnold at becta.org.uk Unsubscribe or
> >change your options at
> >http://mail.python.org/mailman/options/mailman-users/timothy.arnold%40bec 
> ta.org.uk
> >
> >
> >**********************************************************************
> >This email and any files transmitted with it are confidential and
> >intended solely for the use of the individual or entity to whom they
> >are addressed. If you have received this email in error please notify
> >the system manager. This footnote also confirms that this email message
> >has been swept by MIMEsweeper for the presence of computer viruses.
> >www.mimesweeper.com
> >**********************************************************************
> >
> >
> >------------------------------------------------------
> >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/
> >
> >This message was sent to: r.barrett at openinfo.co.uk
> >Unsubscribe or change your options at
> >http://mail.python.org/mailman/options/mailman-users/r.barrett%40openin
> >fo.co.uk
>
>------------------------------------------------------------------------------
>Richard Barrett                                      http://www.openinfo.co.uk
>
>
>
>**********************************************************************
>This email and any files transmitted with it are confidential and
>intended solely for the use of the individual or entity to whom they
>are addressed. If you have received this email in error please notify
>the system manager.
>This footnote also confirms that this email message has been swept by
>MIMEsweeper for the presence of computer viruses.
>www.mimesweeper.com
>**********************************************************************

------------------------------------------------------------------------------
Richard Barrett                                      http://www.openinfo.co.uk





More information about the Mailman-Users mailing list