Rel: [Mailman-Users] feature - multiple web views for adminlists

Bob Weissman rlw at rlw.best.vwh.net
Tue May 21 19:20:22 CEST 2002


At 09:55 AM 5/21/02, Ashley M. Kirchner wrote:
>Terry Davis wrote:
>> Thank you for your reply.  Where can I read up on how to 'recompile' for
>> that directory?  What config files much I change, etc.
>
>    When that's done, recompile, and reinstall.  Do this for each individual vhost.

You don't need to do this. One installation of Mailman is sufficient for multiple vhosts. I have this running just fine on my site. You have to be willing to patch Mailman/Cgi/admin.py, but this is much cleaner than having multiple copies of Mailman.

1. Create your virtual hosts, if you haven't already. Make sure your vhosts are pointing to Mailman for cgi, icons, and pipermail. For Apache, this is (depending on where ~mailman lives):

ScriptAlias /mailman /usr/home/mailman/cgi-bin
<Directory "/usr/home/mailman/cgi-bin">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
</Directory>
Alias /icons /usr/home/mailman/icons
Alias /pipermail /usr/home/mailman/archives/private

This goes inside your <VirtualHost> sections of vhosts.conf for each vhost.

2. In your Mailman/mm_config.py file, make sure that VIRTUAL_HOST_OVERVIEW is set to 1. (I use 2, which is nonstandard, to get an exact vhost match rather than the standard substring match. See patch below. If you have vhost names which are substrings of each other, you will need to use 2 and you will also need to change listinfo.py similarly to admin.py.)

3. Apply the patch below to admin.py. This copies some vhost-discrimination code from listinfo.py to admin.py. It works for 2.0.9 and above (I haven't tried it on older versions.)

4. For each list, change the web_page_url to point to the virtual host. This is the bottom-most parameter on the main admin page for each list. You may need to wait some time for the DNS records of the new vhosts to propagate before people can access the pages.

- Bob

Patch follows

*** admin.py.ORIG       Thu May  9 12:24:58 2002
--- admin.py    Thu May  9 12:32:06 2002
***************
*** 25,30 ****
--- 25,31 ----
  import types
  import rfc822
  import signal
+ from urlparse import urlparse

  from Mailman import Utils
  from Mailman import MailList
***************
*** 200,205 ****
--- 201,229 ----
      for n in names:
        l = MailList.MailList(n, lock=0)
          if l.advertised:
+             # Following cloned from listinfo.py - BW 5/9/02
+           # XXX We need a portable way to determine the host by which we are being
+           #     visited!  An absolute URL would do...
+           http_host = os.environ.get('HTTP_HOST', os.environ.get('SERVER_NAME'))
+           port = os.environ.get('SERVER_PORT')
+           # strip off the port if there is one
+           if port and http_host[-len(port)-1:] == ':'+port:
+               http_host = http_host[:-len(port)-1]
+           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(l.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, l.web_page_url) == -1 and \
+                     string.find(l.web_page_url, http_host) == -1:
+                       # List is for different identity of this host - skip it.
+                       continue
              advertised.append(l)

      if error:






More information about the Mailman-Users mailing list