[Mailman-Users] Mailman Changing real_name Variable in welcome message subject !

Nuno Gonçalves nuno at fccn.pt
Thu Mar 15 11:32:35 CET 2007


Cool Mark,

I followed your directions and it makes all sense, but it appears on the
subject 2 little squares instead of the acceptable alias that is specified
in the conf file :P
I checked the list.conf in conf Directory and acceptable_aliases is
something like : acceptable_aliases = 'test at test.pt'

The other variable that you pointed (self.getListAddress()) also gives me
the list realname.
Do you have any clue what those 2 little squares instead of the list alias
name is ?
To be more specific the subject appears like: Welcome to the mailing list
"[][]"
(the brackets are squares ;) )

Thanks once again mark on your efforts

Best regards

--
Nuno Gonçalves

-----Original Message-----
From: Mark Sapiro [mailto:msapiro at value.net] 
Sent: quinta-feira, 15 de Março de 2007 0:09
To: nuno at fccn.pt; mailman-users at python.org
Subject: Re: [Mailman-Users] Mailman Changing real_name Variable in
welcomemessage subject !

Nuno Gonçalves wrote:
>
>I am looking a way in order to change the subject of the welcome message.
>In the file in [Mailman home directory/Mailman/Deliverer.py] (line 79) 
>there is a line :
>_('Welcome to the "%(realname)s" mailing list%(digmode)s')
>
>
>Is there anyway of subtituting the variable realname for one in the 
>acceptable aliases list (the firts one for instance)?
>Is there any variable acceptable_aliases (confs/list.conf) accessable 
>in the Deliverer.py ?


You could do this in several ways. If you really want to do exactly what you
said, you could change

        realname = self.real_name
        msg = Message.UserNotification(
            self.GetMemberAdminEmail(name), self.GetRequestEmail(),
            _('Welcome to the "%(realname)s" mailing list%(digmode)s'),
            text, pluser)

to

        realname = self.acceptable_aliases[0]
        msg = Message.UserNotification(
            self.GetMemberAdminEmail(name), self.GetRequestEmail(),
            _('Welcome to the "%(realname)s" mailing list%(digmode)s'),
            text, pluser)

but then you have to guarantee that every list has at least one entry in
acceptable_aliases, because referencing self.acceptable_aliases[0] will
throw an IndexError exception if the acceptable_aliases list is empty.

A more realistic approach would just be to use the normal list posting
address, not an alias. Then the code would be

        realname = self.getListAddress()
        msg = Message.UserNotification(
            self.GetMemberAdminEmail(name), self.GetRequestEmail(),
            _('Welcome to the "%(realname)s" mailing list%(digmode)s'),
            text, pluser)

Note that both of the above change only the first line - the assignment to
realname.

If you really wanted to get fancy and use an alias iff there was one, you
could do

        if self.acceptable_aliases:
            realname = self.acceptable_aliases[0]
        else:
            realname = self.getListAddress()
        msg = Message.UserNotification(
            self.GetMemberAdminEmail(name), self.GetRequestEmail(),
            _('Welcome to the "%(realname)s" mailing list%(digmode)s'),
            text, pluser)


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