How can I do this in Python?

Steve Holden steve at holdenweb.com
Fri Nov 4 12:32:51 EST 2005


David Wahler wrote:
> Lad wrote:
> 
>>Hi,
>>I have a web program and a user can have access to a page only after he
>>logged in.
>>So, the program comes with  a Login form and the user logins.But I do
>>not know how to return the user back to where he came from, after a
>>successful login.
>>
>>Something like this:
>>
>>PageWhereUserMustBeLogin -------->UserSigned----->-
>>
>>^------<---------------------------------------------------<----|
>>
>>
>>Thank you for help
>>
>>L.
> 
> 
> You'll need to either use a hidden form field or check the HTTP
> "Referer" header to determine the page the user was on. Then, just use
> an HTTP redirect to send them back to that page.
> 
> Are you using a particular web application framework, or separate CGI
> scripts?
> 
Another alternative might be to serve a script that sent the browser 
back 2 pages in its history, as long as server state hasn't changed in 
the meantime.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list