[Mailman-Developers] specific templates

Thomas Wouters thomas@xs4all.net
Sat, 7 Apr 2001 02:06:47 +0200


On Sat, Apr 07, 2001 at 01:15:15AM +0200, Adriaan Peeters wrote:

> I sent this to the mailman-users list, but they couldn't give me a comple=
te
> answer.
> Does anyone know how to change the automated subcribe confirmation email ?
> It is possible to add a text via the administrative interface, but is't n=
ot
> possible to change the mail completely.  I would like to change the welco=
me
> e-mail completely, perhaps even make html mails from it.

> I tried to copy templates/subscribeack.txt to
> lists/listname/subscribeack.txt and change something in that file, but it
> didn't work :(

What you want is being worked on. Mailman 2.1 will be much more
configurable, as well as multilingual (meaning that your site can be in
English, and your lists can in Dutch, Spanish or Swahili as well as English.
Or the other way 'round) and one of the things that was fixed is that the
emails are better configurable.

Having said that :) it's not *too* hard to convince Mailman to read template
files from the list directory, if you really really want to. You need to
adjust the 'maketext' function in Utils.py to accept a mailinglist-argument,
and if it's passed in, try to find out if its data dir has the template
file. And then you need to go and adjust all maketext calls to include the
list object. (maketext should probably be a method ;)

I did this for a Dutch list we run, since 2.1 wasn't even on the horizon
back then and they *really* wanted to be dutch all the way. And the Mailman
we are running is so hacked up anyway, it's just not funny anymore :) My
maketext looks like this:

def maketext(templatefile, dict, raw=3D0, mlist=3DNone):
    """Make some text from a template file.

    Reads the =14emplatefile', relative to mm_cfg.TEMPLATE_DIR, does string
    substitution by interpolating in the =04ict', and if =12aw' is false,
    wraps/fills the resulting text by calling wrap().
    """
    if mlist:
        file =3D os.path.join(mm_cfg.LIST_DATA_DIR, mlist.internal_name(),
                            templatefile)
        if not os.path.exists(file):
            file =3D os.path.join(mm_cfg.TEMPLATE_DIR, templatefile)
    else:
        file =3D os.path.join(mm_cfg.TEMPLATE_DIR, templatefile)
    fp =3D open(file)
    template =3D fp.read()
    fp.close()
    text =3D template % SafeDict(dict)
    if raw:
        return text
    return wrap(text)

And then I went and adjusted the 15-something calls to maketext.

--=20
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me sp=
read!