[Zope3-Users] How to get at the URL as entered in the browser?

Frank Burkhardt fbo2 at gmx.net
Wed Oct 24 03:11:25 EDT 2007


Hi,

On Tue, Oct 23, 2007 at 11:08:35PM +0800, Yuan HOng wrote:
> Hi, list,
> 
> Is it possible to retrieve the URL the user enters in the browser
> location box? The request's getURL method seems to return the
> traversed URL, including the default view name.
> 
> In particular, I have a custom traverser for my object which extracts
> certain parameters from the URL path instead of the query string, like
> this:
> 
> The url: http://myweb.com/myobject/param1/value1/param2/value2
> 
> The traverser registered for myobject parses the remainder of the URL
> and then set the traversal stack to be empty.

The web server never gets the URL which as typed by the user. At least
the protocol (http vs. https),  is lost. This is what you can do:

 url='http://' + request['HTTP_HOST'] + request['REQUEST_URI']

Regards,

Frank


More information about the Zope3-users mailing list