[Zope-dev] PROPOSAL: Site objects
Adam Feuer
adamf@pobox.com
Thu, 23 Sep 1999 16:56:30 -0700
Quoting Evan Simpson <evan@4-am.com>:
> Allowing arbitrary DTML or Python code to rewrite
> requests before they are resolved could handle any complicated scheme I can
> conceive of.
evan,
yes, this is what i was thinking of with the Mapper.py module--
which is currently very primitive and (probably) un-Zope-like.
> My current (soon-to-be-released) code allows you to designate a single Zope
> object, which must live in the root folder, to be called for this purpose. Its
> return value is ignored, but it can call request methods to do its work. It can,
> of course, call on any number of other objects anywhere in the ZODB.
ok, this is what i intended the Mapper to be-- a central place to
register methods that implement the re-write rules. i envisioned this
object living in the control panel of the VirtualHostFolder product,
but the Root object seems good too.
haven't built a good interface for it yet.
> Once the rewriting is done, and resolution of the URL begins, *we aren't done*.
> I can't tell from your posts whether you are aware of this, but I didn't see it
> in the code.
ahhh, no i don't know this. (!) i am pretty new to Zope, and haven't
tested out the DTML vars URLn, BASEn, etc. :-)
thanks for pointing this out.
> Consider a request for '.../a/b/c', where '...' is handled by the rewriting rules
> (IP/port or HOST, doesn't matter), which decide that this request is for Zope
> path '/site1/a/b/c'. This will work fine, as long as the rendering process never
> refers to URLn, BASEn, or x.absolute_url(). Unfortunately, these are very
> useful, even critical. The management interface and many Products use these all
> over the place.
understood.
> This is where SiteRoots come in. They fix up the URL data in the request as the
> site root is traversed. A 'site root' is just a traversable object which is
> meant to be the target of one or more rewrite rules. In the example scenario,
> 'site1' would be a site root, and would replace '.../site1' with '...' as a URL
> passed through it.
ok, i can prbobably make VirtualHostFolders do that too. as they are
being traversed, they change the request variables to match the
correct URL.
> Note that a SiteRoot can't tell whether a particular request has been rewritten
> with that SiteRoot in mind, or at all. Thus a straight, unchanged request for
> '/site1/a/b/c' will still generate URLs like '.../a/b/c'. I'm not yet sure what,
> if anything, need be done about this.
well, that is an issue in my software too-- if HTTP_HOST is set to
a site in the VirtualHostFolder mapping dictionary, the URL gets
rewritten.
one thing i haven't managed to do is add an object (or another
product) to the VirtualHostFolder control panel object at installation
time.
the rewrite object that you plan to place in the Root object... do
you do this automatically? or does the administrator have to do this??
i'm looking forward to see your take on virtual hosting!
cheers
adam
--
Adam Feuer
adamf@pobox.com