[web2py] Re: Previous location

2010-05-05 Thread Chris
How would you get the current url location? I've tried to build the current url using request.env.http_host + request.env.path_info, but it doesn't take into account routes.py. For example using that method returns 127.0.0.1:8000/init/default/ contact, but I want it to return

Re: [web2py] Re: Previous location

2010-05-05 Thread Jonathan Lundell
On May 5, 2010, at 12:16 PM, Chris wrote: How would you get the current url location? Generally speaking, you want to use URL(r=request, args=request.args, vars=request.vars), or something like that (I may not have all the spelling right). That will not include the host part of the URL,

[web2py] Re: Previous location

2010-05-05 Thread Chris
That works. Thank you On May 5, 3:27 pm, Jonathan Lundell jlund...@pobox.com wrote: On May 5, 2010, at 12:16 PM, Chris wrote: How would you get thecurrenturllocation? Generally speaking, you want to use URL(r=request, args=request.args, vars=request.vars), or something like that (I may

[web2py] Re: Previous location

2010-05-03 Thread mr.freeze
I'm not sure if it's reliable or safe but request.env.http_referer might be what you're looking for. On May 3, 4:39 pm, Miguel Lopes mig.e.lo...@gmail.com wrote: Is there a way to find the previous location / address in an action? For example: Currently inwww.domain.com/a/c/f/arg1 Follow

Re: [web2py] Re: Previous location

2010-05-03 Thread Miguel Lopes
request.env.http_referer is not working for me. I checked (http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z14) and the referer is optionally set by the client. So we can not take it for granted. Miguel On Mon, May 3, 2010 at 10:45 PM, mr.freeze nat...@freezable.com wrote: I'm not sure if

Re: [web2py] Re: Previous location

2010-05-03 Thread Jonathan Lundell
web2py probably isn't setting referer on a redirect, and if it did, you'd have to interpret the URL. How about putting the previous location in session before you redirect? On Mon, May 3, 2010 at 3:05 PM, Miguel Lopes mig.e.lo...@gmail.com wrote: request.env.http_referer is not working for me.

Re: [web2py] Re: Previous location

2010-05-03 Thread Miguel Lopes
On Mon, May 3, 2010 at 11:08 PM, Jonathan Lundell jlund...@pobox.comwrote: web2py probably isn't setting referer on a redirect, and if it did, you'd have to interpret the URL. No. If I have no redirect and call a location with no args the referer is not set when I arrive at web2py's default

Re: [web2py] Re: Previous location

2010-05-03 Thread Jonathan Lundell
On Mon, May 3, 2010 at 11:08 PM, Jonathan Lundell jlund...@pobox.com wrote: web2py probably isn't setting referer on a redirect, and if it did, you'd have to interpret the URL. No. If I have no redirect and call a location with no args the referer is not set when I arrive at web2py's