[Mailman-Users] Mailman Changing real_name Variable in welcomemessage subject !

Mark Sapiro msapiro at value.net
Thu Mar 15 01:08:35 CET 2007


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