[Mailman-Users] add_virtualhost with single argument

Mark Sapiro mark at msapiro.net
Mon Mar 6 15:08:17 EST 2017

On 03/06/2017 11:43 AM, Greg Sims wrote:
> I reviewed mm_cfg.py in the migration process.  I found some
> add_virtualhost statements that I am not sure do anything.  I would like to
> delete them if this is the case.  Here is one of them:
> add_virtualhost('lists.raystedman.org')
> It appears that mailman needs to understand the mappings between url and
> email per:
> # "add_virtualhost(urlfqdn, emailfqdn)" to add new mappings.
> What does having an add_virtualhost with only one parameter mean to
> mailman?  What would happen if I were to delete the add_virtualhost above?

 From Mailman/Defaults.py

> # Helper function; use this in your mm_cfg.py files.  If optional emailhost is
> # omitted it defaults to urlhost with the first name stripped off, e.g.
> #
> # add_virtualhost('www.dom.ain')
> # VIRTUAL_HOST['www.dom.ain']
> # ==> 'dom.ain'

In particular, this means that


has exactly the same effect as

add_virtualhost('lists.raystedman.org', 'raystedman.org')

Also note that add_virtualhost(urlfqdn, emailfqdn) creates a mapping in
the VIRTUAL_HOSTS dictionary from urlfqdn to emailfqdn. Thus if you have
more that one add_virtualhost with the same urlfqdn, whether or not a
second argument is provided, only the last one is effective.

Mark Sapiro <mark at msapiro.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