[Mailman-Developers] patch for virtual host lists

Greg Stein gstein@lyra.org
Sat, 07 Nov 1998 20:08:46 -0800


This is a multi-part message in MIME format.

--------------44F33AF84B58B99E5A2BBBEB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here is a small patch for virtual-hosted lists. The original listinfo.py
would correctly filter the visible lists for a virtual host, but the
hostnames in the title and page contents were wrong.

-g

p.s. the patch is against 1.0b6

--
Greg Stein, http://www.lyra.org/

--------------44F33AF84B58B99E5A2BBBEB
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Received: from ns1.lyra.org (root@ns1.lyra.org [208.192.43.10])
	by svpal.svpal.org (8.9.0/8.9.0) with ESMTP id UAA05628
	for <gstein@svpal.org>; Sat, 7 Nov 1998 20:01:46 -0800 (PST)
Received: from cartman.lyra.org (cartman.lyra.org [208.192.43.15])
	by ns1.lyra.org (8.8.5/8.8.5) with ESMTP id UAA31040
	for <gstein@lyra.org>; Sat, 7 Nov 1998 20:06:52 -0800
Received: (from mailman@localhost)
	by cartman.lyra.org (8.8.7/8.8.7) id UAA05316
	for gstein@lyra.org; Sat, 7 Nov 1998 20:06:32 -0800
Date: Sat, 7 Nov 1998 20:06:32 -0800
From: The Mailman <mailman@cartman.lyra.org>
Message-Id: <199811080406.UAA05316@cartman.lyra.org>

*** listinfo.py-dist	Sat Nov  7 20:03:01 1998
--- listinfo.py	Sat Nov  7 20:05:31 1998
***************
*** 57,64 ****
  
  def FormatListinfoOverview(error=None):
      "Present a general welcome and itemize the (public) lists for this host."
      doc = Document()
!     legend = "%s mailing lists" % mm_cfg.DEFAULT_HOST_NAME
      doc.SetTitle(legend)
  
      table = Table(border=0, width="100%")
--- 57,76 ----
  
  def FormatListinfoOverview(error=None):
      "Present a general welcome and itemize the (public) lists for this host."
+ 
+     # XXX We need a portable way to determine the host by which we are being 
+     #     visited!  An absolute URL would do...
+     if os.environ.has_key('HTTP_HOST'):
+ 	http_host = os.environ['HTTP_HOST']
+     else:
+ 	http_host = None
+     if mm_cfg.VIRTUAL_HOST_OVERVIEW and http_host:
+ 	host_name = http_host
+     else:
+ 	host_name = mm_cfg.DEFAULT_HOST_NAME
+ 
      doc = Document()
!     legend = "%s mailing lists" % host_name
      doc.SetTitle(legend)
  
      table = Table(border=0, width="100%")
***************
*** 70,82 ****
      names = Utils.list_names()
      names.sort()
  
-     # XXX We need a portable way to determine the host by which we are being 
-     #     visited!  An absolute URL would do...
-     if os.environ.has_key('HTTP_HOST'):
- 	http_host = os.environ['HTTP_HOST']
-     else:
- 	http_host = None
- 
      for n in names:
  	l = MailList.MailList(n, lock = 0)
  	if l.advertised:
--- 82,87 ----
***************
*** 99,105 ****
  			 "<p>"
  			 " There currently are no publicly-advertised ",
  			 Link(mm_cfg.MAILMAN_URL, "mailman"),
! 			 " mailing lists on %s." % mm_cfg.DEFAULT_HOST_NAME,
  			 )
      else:
  
--- 104,110 ----
  			 "<p>"
  			 " There currently are no publicly-advertised ",
  			 Link(mm_cfg.MAILMAN_URL, "mailman"),
! 			 " mailing lists on %s." % host_name,
  			 )
      else:
  
***************
*** 108,114 ****
              "<p>"
              " Below is the collection of publicly-advertised ",
              Link(mm_cfg.MAILMAN_URL, "mailman"),
!             " mailing lists on %s." % mm_cfg.DEFAULT_HOST_NAME,
              (' Click on a list name to visit the info page'
               ' for that list.  There you can learn more about the list,'
               ' subscribe to it, or find the roster of current subscribers.'),
--- 113,119 ----
              "<p>"
              " Below is the collection of publicly-advertised ",
              Link(mm_cfg.MAILMAN_URL, "mailman"),
!             " mailing lists on %s." % host_name,
              (' Click on a list name to visit the info page'
               ' for that list.  There you can learn more about the list,'
               ' subscribe to it, or find the roster of current subscribers.'),


--------------44F33AF84B58B99E5A2BBBEB--