[Zope-dev] using VirtualHostMonster in a ZPublisher python module?

Leonardo Rochael Almeida leo at hiper.com.br
Tue Sep 21 12:38:46 EDT 2004

Em Ter, 2004-09-21 às 12:17, Royce escreveu:
> Was hoping to hear of a way to insert a VHM into my zpublisher app
> object tree or something. Could just hack in hardwired cleanup for URL
> and BASE but that seems ugly.

The code in VHM is really not that complicated. I recommend you read it
so that you understand how to change your application to emulate or
integrate it.

Basically it hooks itself up into __bobo_traverse__ so that it gets
called when the request comes in, before all objects in the path (after
the root) are looked up. When called, VHM alters the request information
(server and path, and as a consequence BASE* and URL*) which has the
consequence of changing what objects are looked up to handle the request
(i.e. no need for objects called VirtualHostBase or VirtualHostRoot).

This is done thru Request methods that where created exactly for this
purpose: .setServerURL() and .setVirtualRoot()

Documentation for those can be found in the Zope Online Help and other

Cheers, Leo

Leonardo Rochael Almeida <leo at hiper.com.br>

More information about the Zope-Dev mailing list