[Mailman-Users] changing the Welcome message on a per list basis... a shot in the dark

Jon Carnes jonc at haht.com
Thu Apr 11 18:28:51 CEST 2002


Okay, here is the deal...

 - You can simply change the text in subscribeack.txt and you are done.
This changes every welcome message from every list, or

 - You can edit the file ~mailman/Mailman/Deliverer.py and change the
following block of text so that it will check for an existence of an
alternative file to 'subscribeack.txt':
===
        # get the text from the template
        text = Utils.maketext(
            'subscribeack.txt',
            {'real_name'   : self.real_name,
             'host_name'   : self.host_name,
             'welcome'     : welcome,
             'emailaddr'   : self.GetListEmail(),
             'listinfo_url': self.GetScriptURL('listinfo', absolute=1),
             'optionsurl'  : self.GetOptionsURL(name, absolute=1),
             'password'    : password,
             })
===

The following function added to Deliverer.py may help..."
===
def specwelcome(listname):
    """Return special welcome file for `listname' if it exists."""
    # If a special subscibeack.txt file exists in the lists home directory
    # use that instead of the normal one specified in the templates dir
welcfile = os.path.join(mm_cfg.LIST_DATA_DIR, listname, 'subscribeack.txt')
if not os.path.exists(welcfile):
     welcfile = "subscribeack.txt"
return welcfile
===

This function looks for a copy of the subscribeack.txt file in the lists
home directory (~mailman/lists/<listname>/..).  If it finds a copy then it
uses that, instead of the common one in ~mailman/templates/...
At least, that is what it's supposed to do!

To use it, you would add the function to Deliverer.py and then replace the
existing line (in Deliverer.py):
            'subscribeack.txt',
with something like:
            specwelcome(name),

===

I'm just hacking code together, so this may or may not hose you.  Still its
a start.  Don't be afraid to play with it and get it working just the way
you want!  Python is extremely readable code (unlike perl!).  Remember to
backup any file before you modify it!

Jon Carnes
----- Original Message -----
From: "Mark Moshe Kaye" <jotd2k at yahoo.com>
To: <jonc at nc.rr.com>
Cc: <mailman-users at python.org>
Sent: Thursday, April 11, 2002 9:30 AM
Subject: Re: [Mailman-Users] How do I suppress ?


> Jon,
>
> Thank you !
>
> As i am just learning Linux/mailman I would appreciate
> it if you could tell me what file I need to edit. I
> already fixed the list specific HTML pages but I am
> unsure where to put that change and would rather not
> hack without knowing what I am hacking.
>
> Thanks,
> Moshe
>
> >
> > Well that's ridiculous!  I can think of a
> > work-around right now (without
> > having even glanced at the code).
> >
> > Find the section of mailman that sends out the
> > Message and add a conditional.
> > Something like,
> >   if welcome.<listname>.txt exists welcome.fil =
> > welcome.<listname>.txt
> >   else welcome.fil = welcome.txt
> >
> > Then simply put in a custom welcome file for any
> > list that you want.  This
> > works for any of the other files you want to use in
> > Mailman as well.
> >
> > I'll see if I can find the official work-around.  If
> > not, I'll look at the
> > code and see if I can pinpoint it for you quickly.
> >
> > Jon Carnes
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.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






More information about the Mailman-Users mailing list