Re: [Zope3-Users] How to get at the URL as entered in the browser?
Hi, On Thu, Oct 25, 2007 at 08:51:41AM +0800, Yuan HOng wrote: > On 10/24/07, Frank Burkhardt <[EMAIL PROTECTED]> wrote: > > > > > 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'] > > > > Does this work for Zope3? I use zopeproject, and starting the server with I don't know what zopeproject does but I use Zope3 (exclusively). Regards, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How to get at the URL as entered in the browser?
On 10/24/07, Frank Burkhardt <[EMAIL PROTECTED]> wrote: > > 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'] > Does this work for Zope3? I use zopeproject, and starting the server with bin/paster serve debug.ini It doesn't seem that the request has a key 'REQUEST_URI': (Pdb) request http://rhodium.homemaster.cn/products/101> (Pdb) request.keys() ['HTTP_MAX_FORWARDS', 'HTTP_ACCEPT_LANGUAGE', 'SCRIPT_NAME', 'REQUEST_METHOD', 'PATH_INFO', 'SERVER_PROTOCOL', 'QUERY_STRING', 'paste.throw_errors', 'HTTP_X_FORWARDED_SERVER', 'CONTENT_LENGTH', 'HTTP_ACCEPT_CHARSET', 'HTTP_USER_AGENT', 'HTTP_CONNECTION', 'SERVER_NAME', 'REMOTE_ADDR', 'wsgi.url_scheme', 'SERVER_PORT', 'paste.evalexception', 'wsgi.input', 'HTTP_HOST', 'wsgi.handleErrors', 'wsgi.multithread', 'HTTP_ACCEPT', 'wsgi.version', 'wsgi.run_once', 'wsgi.errors', 'wsgi.multiprocess', 'HTTP_X_FORWARDED_HOST', u'page', 'HTTP_X_FORWARDED_FOR', 'CONTENT_TYPE', 'paste.httpserver.thread_pool', 'HTTP_ACCEPT_ENCODING'] (Pdb) request['REQUEST_URI'] *** KeyError: 'REQUEST_URI' -- Hong Yuan 大管家网上建材超市 装修装潢建材一站式购物 http://www.homemaster.cn ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How to get at the URL as entered in the browser?
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 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users