[Mailman-Users] set mailman default fornonmember_rejection_notice

Mark Sapiro msapiro at value.net
Tue Feb 7 19:45:15 CET 2006


Christopher Adams wrote:

>That is good to know. Is the Mailman/Handlers/Moderate.py file 
>overwritten in an upgrade?


Yes. basically all the python modules except mm_cfg.py are overwritten
in an upgrade.


>I recently changed all lists using withlist 
>to use specific text for rejected non-member messages. If I modify the 
>Moderate.py file, that should take care of all new lists, unless a list 
>owner chooses to modify their list.


Changing this in Moderate.py is not the way to go. Look at
Mailman/MailList.py in the definition of InitVars, you'll see
something like the following without the line wrapping.

        self.forward_auto_discards =
mm_cfg.DEFAULT_FORWARD_AUTO_DISCARDS
        self.generic_nonmember_action =
mm_cfg.DEFAULT_GENERIC_NONMEMBER_ACTION
        self.nonmember_rejection_notice = ''
        # Ban lists
        self.ban_list = []

Here you change

        self.nonmember_rejection_notice = ''

to (again watch for wrapped line)

        self.nonmember_rejection_notice =
mm_cfg.DEFAULT_NONMEMBER_REJECTION_NOTICE

and put

DEFAULT_NONMEMBER_REJECTION_NOTICE = ''

in Defaults.py. This is not critical in your case, but it would be
required (actually in Defaults.py.in) for a general patch.

Then you can put

DEFAULT_NONMEMBER_REJECTION_NOTICE = """First line of notice
second line
etc.
last line
"""

in mm_cfg.py and it will work.

This is not quite so simple to do in the Mailman distribution because
the text that actually winds up in the list's
nonmember_rejection_notice should be in the language of the list, and
there's no way to translate arbitrary text. I.e., consider a site that
supports lists in multiple languages. The fixed text built in to
Moderate.py can be replaced on the fly with the translation into the
list's language, but arbitrary text in mm_cfg.py can't be translated
in this way. It would be entered in one language and even if the
language of the new list is different, it wouldn't be translated for
that list.

Thus, the practical solution given the way i18n works in Mailman is to
have the default be the canned message, and let the list owner provide
the desired text if it's different.

Allowing a sitewide, arbitrary, default message just wouldn't work for
multi-language sites.

So, in your case, the best thing is to put the default text in
mm_cfg.py as above and then remember to make the one-line patch in
MailList.py after any upgrade.

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