[Zope-dev] PROPOSAL: Site objects

Evan Simpson evan@tokenexchange.com
Tue, 21 Sep 1999 15:18:34 -0500


I wonder how many other great minds have been thinking alike, here.  No
doubt we'll be hearing from them soon <wink>.

----- Original Message -----
From: Adam Feuer <adamf@pobox.com>
>   the thing i have works, it is a product and a couple of patches to
> Zope, but it has some issues. i'll post the code this evening, after i
> clean it up a bit, it might be useful to you.

Excellent.

> o VirtualHostFolders derive from the Folder Object
>     -- with an additional property, IPaddress
>        (this will eventually be a list of IPaddresses?)

Looks like different needs have spawned different approaches, here.  I
didn't even think about IP/port issues, since I operate all of my sites from
a single address/port through Apache.  Obviously both cases will need to be
handled.

> o Small patch to ZPublisher
>    -- allows registration of multiple remapper methods.
>       takes as arguments the object path and the REQUEST, returns a
>       new (remapped) path.

See my other post, where I lay out something roughly like this, except that
the method doesn't return the new path, it passes it to a (new) method of
REQUEST.

>   one problem or issue i've been grappling with is: where to you store
> the dictionary of IPaddresses and path_prefixes?

I have hit the same wall, and I'm climbing it now.  This looks like a
standard problem/pattern for Zope Products; How do you keep 'global'
information available to instances of classes defined in the Product,
preferably in a standard object in the standard storage.  I surmise that
this isn't a problem for ZClass-based Products <sigh>.

>   why i did it this way: if you take the SiteObject or SiteRoot ways,
> you still need a centralized dictionary or IPaddress:path mappings...
> at least it seems this way to me. for performance reasons you don't
> want to go looking all over the ZODB hierarchy for every request. :-)

I quite agree.  On the other hand, I think it's a Good Thing to separate the
act of path extension ('www.site.com/thing' => '/here/is/the/site/thing')
from that of logical URL definition ("Everything inside me starts with
'www.site.com/'").  That way, you can define logical URLs once and for all
at the location of the site root, while handling direct-to-ZServer requests
differently from pre-rewritten through-Apache ones.

>   i thought about making a product that you could just drop into a
> folder to make it a Virtual Host, but then... you get the issues of
> needing to make these invisible to non-managers, you still need a
> centralized dictionary, etc.

Only the path-extension/rewriting part needs a central dictionary.  Does it
really need to be invisible to non-managers, or is it enough that they can't
mess with it?  Only users with "Add new <whatever>" permissions on a folder
should be allowed to view/change/delete the <whatever> object.