FAQ
Hi all,

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 ?

The objective here is that the list address alias is in the subject line
instead of the list realname.

Any hint is appreciated

best regards to you all

--
Nuno Gon?alves

Search Discussions

  • Mark Sapiro at Mar 15, 2007 at 12:08 am

    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
  • Nuno Gonçalves at Mar 15, 2007 at 10:32 am
    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
  • Mark Sapiro at Mar 16, 2007 at 1:22 am

    Nuno Gon?alves wrote:
    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.

    Not exactly. It shoud give 'real_name at host_name' instead of just
    'real_name'.

    I thought you perhaps wanted a list email address as opposed to just a
    name which is why I suggested that.

    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 ;) )

    The squares may represent non-printing characters which may be an issue
    if the acceptable_aliases field begins with a blank line.

    This is partially my error. I was thinking that acceptable_aliases is a
    list, but it is not. It is a string. The construct
    acceptable_alaises[0] returns the first character of the string, which
    if acceptable_aliases = 'test at test.pt', is simply 't', so I don't know
    what the two 'squares' are unless acceptable_aliases begins with a
    blank line, in which case they are probably some representation of a
    carriage-return character.

    So now I have another question. If you don't want people to see the
    name of the list in the subject of the welcome message, why don't you
    just change the list name - see
    <http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq04.070.htp>.

    If you really want to keep the list name as is and put the first entry
    from acceptable aliases in the welcome subject, this should do it.

    list_aliases = [alias.strip() for alias in
    self.acceptable_aliases.split()]
    realname = None
    for realname in list_aliases:
    if realname:
    break
    if not realname:
    realname = self.real_name
    msg = Message.UserNotification(
    self.GetMemberAdminEmail(name), self.GetRequestEmail(),
    _('Welcome to the "%(realname)s" mailing list%(digmode)s'),
    text, pluser)

    That will use the first non-empty line from acceptable_aliases if any
    and the list's real_name if there is no non-empty acceptable_aliases
    line.

    --
    Mark Sapiro <msapiro at value.net> The highway is for gamblers,
    San Francisco Bay Area, California better use your sense - B. Dylan

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmailman-users @
categoriespython
postedMar 14, '07 at 4:12p
activeMar 16, '07 at 1:22a
posts4
users2
websitelist.org

2 users in discussion

Nuno Gonçalves: 2 posts Mark Sapiro: 2 posts

People

Translate

site design / logo © 2023 Grokbase