[Mailman-Users] help re: web_page_url and virtual hosts

Richard Barrett r.barrett at openinfo.co.uk
Fri Nov 14 17:27:10 CET 2003

On Friday, November 14, 2003, at 04:00  pm, Thomas C. Fischer wrote:

> Hi Richard,
> thanks for your answer! I appreciate talking to someone who apparently
> knows what he is talking about! ;-)
>>> Forgive me when I laugh... This FAQ entry is quoted every single time
>>> someone asks about URLs in mailman. And I have never met anybody 
>>> whose
>>> problem got solved through reading it...
>> Well, you and anybody else who has the time and energy to do better is
>> welcome to rewrite that FAQ or any another. It is Open Software and
>> anybody can contribute ....
> Didn't want to offend anybody - forgive me if this sounded slightly
> sarcastic. I wish I could rewrite the FAQ - it's just that I simply
> haven't understood how these parameters are working together...
>> Have your read the output from $prefix/bin/newlist --help ? It says in
>> part:
>> <quote>
>> You can specify the domain to create your new list in by spelling the
>> listname
>> like so:
>>      mylist at www.mydom.ain
>> where `www.mydom.ain' should be the base hostname for the URL to this
>> virtual
>> hosts's lists.  E.g. with is setting people will view the general list
>> overviews at http://www.mydom.ain/mailman/listinfo.  Also, 
>> www.mydom.ain
>> should be a key in the VIRTUAL_HOSTS mapping in mm_cfg.py/Defaults.py.
>> It
>> will be looked up to give the email hostname.  If this can't be found,
>> then
>> www.mydom.ain will be used for both the web interface and the email
>> interface.
>> </quote>
> Yup! And the important part seems to be the "key in the VIRTUAL_HOSTS
> mapping"-thingy... What mailman does in my case is that it uses
> www.mydom.ain for both the web interface and the email interface, 
> although
> I use the settings described below...
>>> Look here:
>>> DEFAULT_EMAIL_HOST = 'mailhost.name'
>>> DEFAULT_URL_HOST = 'my.webhost.name'
>>> DEFAULT_URL_PATTERN = 'https://%s/mailman/'
>>> VIRTUAL_HOSTS.clear()
>>> Now tell my why this doesn't do the trick?! The mail for the list 
>>> admin
>>> still has the link
>>> https://mailhost.name/mailman/admin/test
>>> But instead of mailhost.name it should have my.webhost.name, don't 
>>> you
>>> reckon?
>> Only if the list was created after the assignments you cite above were
>> extant when the list was created. Are you saying that if you now 
>> create
>> another test list, you get the wrong results?
> Yes, that's what I am saying. With the above settings I do a
>  bin/newlist test at mailhost.name

But you should be doing:

     bin/newlist test at webhost.name

Which is what the command usage is trying to tell you to do. Yes, it 
may be counter-intuitive but the --help output is quite clear if you 
actually read it carefully.

> And then it will use the mailhost.name in the webhost-corner!
> It works fine as long as I simply say
> bin/newlist test - without the mailhost.name thing...
> But after all there are more virtual hosts on my machine...

If you supply the web host domain in the newlist parameter, the code 
that does the setup of the new list's web_page_url and mail host_name 
attributes is as follows:

     host_name = None
     web_page_url = None
     if '@' in listname:
         listname, domain = listname.split('@', 1)
         host_name = mm_cfg.VIRTUAL_HOSTS.get(domain, domain)
         web_page_url = mm_cfg.DEFAULT_URL_PATTERN % domain

It just does a simple dictionary lookup of the virtual hosts you have 
defined for your site. If the lookup fails then the domain on the 
command parameter is used for both mail and web hosts. There is not a 
whole lot to go wrong with this code.

> Once again: Thanks for your ongoing help.
> Regards,
> Tom

More information about the Mailman-Users mailing list