[Mailman-Users] Can mm_cfg.py use includes?

Mark Sapiro msapiro at value.net
Thu Apr 27 07:21:18 CEST 2006


simba at vmailtest.ao.net wrote:
>
>     I'm not terribly familiar with Python programming, and the only thing
>I can find that's similar to what I want to do is the "import"
>command.  It's not working like I'd hoped because when I add a "from
>vhosts_cfg import *" to mm_cfg.py, the Mailman web scripts just come
>back with "We've found a bug!" errors and nothing shows up in
>/var/log/mailman/error.  I did remember to create an
>/etc/mailman/vhosts_cfg.py test file with correct addvirtualhost()
>usage syntax and made a symlink to it in /var/lib/mailman/Mailman, so
>it shouldn't be a matter of a missing file.


import is not include

You can't just put an add_virtualhost('a','b') line in a file and
import it into mm_cfg.py, because 'add_virtualhost' is undefined in
the file you're importing.

You don't get an error log entry because the traceback logging in
scripts/driver does this

    try:
        from Mailman.mm_cfg import VERSION
    except ImportError:
        VERSION = '<undetermined>'

but when you have syntax or other errors occurring in the import, the
exception thrown is not ImportError and the whole thing dies right
there. You might find the error in the web server's error log.

To actually see what the problem is, do

cd  /var/lib/mailman/Mailman
python

>>> import mm_cfg

And you'll see the errors. This won't necessarily tell you what to do,
but it will tell you what you can't do.

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