[Mailman-Developers] true virtual hosting patch for 2.1 on RHEL6
Mark Sapiro
mark at msapiro.net
Wed May 29 01:50:04 CEST 2013
On 05/28/2013 04:48 AM, Graham Leggett wrote:
>
> Here is another small issue, when VIRTUAL_HOST_OVERVIEW was switched off to allow all virtual lists to appear on the same host, the host_name of the list wasn't passed in the URL. The attached patch fixes this.
>
> diff -u -r mailman-2.1.12/Mailman/MailList.py mailman-2.1.12-patched/Mailman/MailList.py
> --- mailman-2.1.12/Mailman/MailList.py 2013-05-28 10:39:09.333154778 +0000
> +++ mailman-2.1.12-patched/Mailman/MailList.py 2013-05-28 10:40:57.874209489 +0000
> @@ -252,6 +252,9 @@
> def GetScriptURL(self, scriptname, absolute=0):
> # Using "local_part" here works for both site wide lists on
> # the default url host and for vhost lists on the vhost url host.
> + if not mm_cfg.VIRTUAL_HOST_OVERVIEW:
> + return Utils.ScriptURL(scriptname, self.web_page_url, absolute) + \
> + '/' + self.local_part + '@' + self.host_name
> return Utils.ScriptURL(scriptname, self.web_page_url, absolute) + \
> '/' + self.local_part
>
Actually, that patch is not what's required. The comment is wrong.
@hostname is required for all vhosts lists regardless of the host name
in the URL or the setting of VIRTUAL_HOST_OVERVIEW.
A correct patch is attached.
As for the patch below, I see what you're trying to do, but I'm nervous
about untended consequences of creating lists in domains not in
VIRTUAL_HOSTS. I think the patch should be OK, but as I say, I'm nervous
about it.
I will definitely commit the attached patch, and I'll think about the
other. Do you have any motivation for it other than just not wanting to
bother with adding add_virtualhost() to mm_cfg.py?
> diff -u -r mailman-2.1.12/bin/newlist mailman-2.1.12-patched/bin/newlist
> --- mailman-2.1.12/bin/newlist 2013-05-28 10:39:09.339158852 +0000
> +++ mailman-2.1.12-patched/bin/newlist 2013-05-28 10:21:04.730131451 +0000
> @@ -165,7 +165,7 @@
> emailhost = domain
> elif emailhost != domain:
> usage(1, C_('You cannot use an email host different from the domain part of the list name.'))
> - if not mm_cfg.VIRTUAL_HOSTS.has_key(urlhost):
> + if mm_cfg.VIRTUAL_HOST_OVERVIEW and not mm_cfg.VIRTUAL_HOSTS.has_key(urlhost):
> _urlhost = repr(urlhost)
> _emailhost = repr(emailhost)
> usage(1, C_('The Mailman config file lacks a line mapping urlhost to emailhost:\n add_virtualhost(%(_urlhost)s,\n %(_emailhost)s)'))
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
-------------- next part --------------
--- ../vhost/Mailman/MailList.py 2013-05-25 16:00:50.930182026 -0700
+++ Mailman/MailList.py 2013-05-28 16:26:36.696692828 -0700
@@ -250,10 +250,10 @@
return "%s%s@%s" % (acct, self.umbrella_member_suffix, host)
def GetScriptURL(self, scriptname, absolute=0):
- # Using "local_part" here works for both site wide lists on
- # the default url host and for vhost lists on the vhost url host.
- return Utils.ScriptURL(scriptname, self.web_page_url, absolute) + \
- '/' + self.local_part
+ return '%s/%s' % (
+ Utils.ScriptURL(scriptname, self.web_page_url, absolute),
+ self.internal_name()
+ )
def GetOptionsURL(self, user, obscure=0, absolute=0):
url = self.GetScriptURL('options', absolute)
More information about the Mailman-Developers
mailing list