[Mailman-Developers] Putting teeth in VIRTUAL_HOST_OVERVIEW
Bob Weissman
rlw@rlw.best.vwh.net
Wed, 08 May 2002 12:51:27 -0700
The VIRTUAL_HOST_OVERVIEW in Mailman 2.0.10 doesn't do what I want. I need to hide lists on a virtual host masquerading as a subdomain. That is, I don't want lists on internal.foo.org to be visible in the listinfo for foo.org. Currently, they are.
May I propose a modification? Currently, VIRTUAL_HOST_OVERVIEW is either 0 or 1. I'd like to set it to 2 to indicate an exact virtual host name match must be performed, rather than a substring check. Something like the following.
Thanks for your consideration,
- Bob
*** Defaults.py.orig Wed May 8 10:25:03 2002
--- Defaults.py Wed May 8 11:52:18 2002
***************
*** 230,235 ****
--- 230,239 ----
# included within the URL by which the page is visited - only those "on the
# virtual host". If unset, then all lists are included in the overview. The
# admin page overview always includes all the lists.
+ #
+ # If set to 2, the match must be an exact virtual host match. That is,
+ # lists from private.foo.com will not be displayed on the overview
+ # for foo.com. (They will be displayed there if this is set to 1.)
VIRTUAL_HOST_OVERVIEW = 1
DEFAULT_FILTER_PROG = '' # Currently not used!
***************
*** Cgi/listinfo.py.orig Wed May 8 10:25:03 2002
--- Cgi/listinfo.py Wed May 8 11:52:18 2002
***************
*** 22,27 ****
--- 22,28 ----
import os
import cgi
import string
+ from urlparse import urlparse
from Mailman import mm_cfg
from Mailman import Utils
***************
*** 83,96 ****
for n in names:
mlist = MailList.MailList(n, lock=0)
if mlist.advertised:
! if mm_cfg.VIRTUAL_HOST_OVERVIEW and \
! http_host and \
string.find(http_host, mlist.web_page_url) == -1 and \
string.find(mlist.web_page_url, http_host) == -1:
! # List is for different identity of this host - skip it.
! continue
! else:
! advertised.append(mlist)
if error:
greeting = FontAttr(error, color="ff5060", size="+1")
--- 84,105 ----
for n in names:
mlist = MailList.MailList(n, lock=0)
if mlist.advertised:
! if mm_cfg.VIRTUAL_HOST_OVERVIEW:
! if mm_cfg.VIRTUAL_HOST_OVERVIEW == 2: # Want an exact match
! # extract the host part of the url
! host_part = urlparse(mlist.web_page_url)[1]
! # remove the port, if any
! host_part = string.split(host_part, ":")[0]
! if http_host and host_part != http_host:
! # List is for different vhost - skip it.
! continue
! else: # Want a simple containment match
! if http_host and \
string.find(http_host, mlist.web_page_url) == -1 and \
string.find(mlist.web_page_url, http_host) == -1:
! # List is for different identity of this host - skip it.
! continue
! advertised.append(mlist)
if error:
greeting = FontAttr(error, color="ff5060", size="+1")