[Zope-dev] Zope 2.6 planning - call for contributors!

Gary Poster Gary Poster" <garyposter@earthlink.net
Mon, 4 Mar 2002 00:22:56 -0500


From: "Chris Withers" <chrisw@nipltd.com>
> Gary Poster wrote:
> >
> > If there is any interest in spiffing the Virtual Host Folder up for
> > inclusion in Zope 2.6, I'll do the work.  It requires Ordered Folder
0.5.1,
> > and needs just a bit more spiffing.
>
> Why does it require ordered folder? What does that have to do with virtual
hosting?

Well--the best answer is to suggest you look at it.

The next best answer is to say that the ability to order virtual host rules
(as in, for instance, the Apache httpd.conf virtual host section) is very
convenient.

And the full-blown I-can't-help-but-give-an-example is this.  The Virtual
Host Folder (hereafter VHF) holds implementations of IHost.  Each IHost
implementation is responsible for mappings to one virtual Zope root.  (There
is an exception but I'm not going in to it here).  So if, for instance, your
site is mysite.com and you wanted to have all subdomains (www.mysite.com,
anything.mysite.com, etc.) go to a given zope root then you create one host
object that uses a regular expression like
^(.*\.|)mysite.com$
and points to your desired virtual zope root.  Then, if you in fact want
certain subdomains at mysite.com to have a different Zope root, create a new
host pointing to your alternate root and use a simple match like
special.mysite.com
Move this host higher than the catch-all host in the VHF using the
OrderedFolder controls and you are set to go.

While I did in fact roll my own ordered folder-like mix-in for this purpose
initially (so I would have no dependencies), using OrderedFolder allows
developers to create their own personalized implementations of the IHost
interface (somebody wanted to hook their DNS and email system to their
hosts, for instance, and this is not easily generalized) and just drop the
new implementations (or subclasses) into the Products folder without making
any changes to the VirtualHostFolder distribution itself.

And by the way:  TO DO list on the VHF before it would be any kind of core
candidate:

1) TESTS
2) Some kind of fish bowl to more rigorously plan an API--not convinced I
can get critical mass of interest behind it to make it worthwhile though...
maybe I'll get around to it and we'll see.
3) OrderedFolder has some ZBabel-related problems on one of my
installations; not sure of the cause/fix yet.

Gary