[Mailman-Users] using mailing list folder in archive template

Mark Sapiro mark at msapiro.net
Fri Nov 18 23:10:08 CET 2011


Jason Fayre wrote:

>I am relatively new to Mailman.  I am administering a server with around 
>200 lists on it.  I am setting up Swish-e to provide searchable list 
>archives.  Each list has it's own search.  In the search form, I need to 
>be able to reference a cgi script.
>Each list has its own cgi script in the mailman cgi-bin folder.  The 
>names of the cgi scripts are the same as the folder containing the 
>mailing list in mailman.
>I thought I could just use %(listname)s in my templates to reference 
>this.  Unfortunately, this is returning the friendly list name, not the 
>name of the folder where the list resides.  I can change my cgi script 
>names if I need to, but I was wondering if there is a template tag I can 
>use to insert the name of the list as it appears in the mailman lists 
>directory.
>Also, is there a list of the mailman tags that can be used in these 
>templates?


In general the code that uses any particular template has its own
dictionary of substitution variables and with very few exceptions the
only names in the dictionary are those that appear in that particular
template.

Assuming you are modifying the archtoc.html and/or archtocnombox.html
templates, you could edit Mailman/Archiver/HyperArch.py as follows:

Find the section

    def html_TOC(self):
        mlist = self.maillist
        listname = mlist.internal_name()
        mbox = os.path.join(mlist.archive_dir()+'.mbox',
listname+'.mbox')
        d = {"listname": mlist.real_name,
             "listinfo": mlist.GetScriptURL('listinfo', absolute=1),
             "fullarch": '../%s.mbox/%s.mbox' % (listname, listname),
             "size": sizeof(mbox, mlist.preferred_language),
             'meta': '',
             }

add the line

             "internalname": mlist.internal_name(),

to make it

    def html_TOC(self):
        mlist = self.maillist
        listname = mlist.internal_name()
        mbox = os.path.join(mlist.archive_dir()+'.mbox',
listname+'.mbox')
        d = {"listname": mlist.real_name,
             "internalname": mlist.internal_name(),
             "listinfo": mlist.GetScriptURL('listinfo', absolute=1),
             "fullarch": '../%s.mbox/%s.mbox' % (listname, listname),
             "size": sizeof(mbox, mlist.preferred_language),
             'meta': '',
             }

and restart Mailman. Then you could use %(internalname)s in the
template to be replaced with the list's internal (all lower case) name.

-- 
Mark Sapiro <mark at msapiro.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