[Bug 925502] Re: VAR_PREFIX should be runtime-configurable

Mark Sapiro mark at msapiro.net
Fri Feb 3 02:35:03 CET 2012

Various Mailman modules get the settings via the Python statement

from Mailman import mm_cfg

This causes Python to read mm_cfg.py and execute all the statements
therein.  The first executable statement in mm_cfg.py, at least as
distributed, is

from Defaults import *

This causes Python to read Defaults.py and execute all the statements
therein and then make every name from that module available in the
current namespace. Thus, at this point, everything defined in
Defaults.py is available with its default value. Python then continues
to execute the remaining statements in mm_cfg.py which normally serve to
redefine some of the defaults.

If the order were reversed, i.e. if the

from Defaults import *

statement were at the end of mm_cfg.py instead of the beginning, all the
default definitions would override anything previously set in mm_cfg.py
which obviously wouldn't work. Additionally,  It would also cause any
statements in mm_cfg.py which depend on definitions in Defaults.py such
as the helper functions add_virtualhost() to fail.

To do what you suggest in the way you suggest would require implementing
a special purpose Python parser within Mailman to read Defaults .py and
set only those things which were unset. Also, the problem of the helper
functions being undefined at mm_cfg.py time would still exist. This is
not a viable approach.

If we were doing this from scratch, we could split Defaults.py into two
pieces, one which set all the direct variables and one which set all
those things defined in terms of things set in the first piece. Then
mm_cfg.py could import all the definitions from the first part at the
beginning and all those from the second part at the end, but this is not
viable for two reasons.

It would break every installation with an existing mm_cfg.py, i.e. every
existing installation.

It would make it impossible to override any of the things defined in the
second part.

If you can come up with a patch to do what you want that would work in
all cases and not break any existing mm_cfg.py files, I would consider
it. In the mean time, you have the solution in comment #1.

You received this bug notification because you are a member of Mailman
Coders, which is subscribed to GNU Mailman.

  VAR_PREFIX should be runtime-configurable

To manage notifications about this bug go to:

More information about the Mailman-coders mailing list