durusmail: quixote-users: Fwd: Re: [Quixote-users] Further simplification of session code
Fwd: Re: [Quixote-users] Further simplification of session code
2002-05-17
Re: Fwd: Re: [Quixote-users] Further simplification of session code
2002-05-17
Re: Fwd: Re: [Quixote-users] Further simplification of session code
2002-05-17
Re: Fwd: Re: [Quixote-users] Further simplification of session code
2002-05-17
Fwd: Re: [Quixote-users] Further simplification of session code
Michael Watkins
2002-05-17
At 11:30 AM 5/17/2002 -0400, you wrote:
 >>>.  We originally put the "return URL"
in the session object, but for reasons that I cannot remember it didn't
work.  I'm pretty sure the !#^%@#^! "Back" button was involved.  We now
put it in the URL, so if you try to access /private/, you are redirected
to /user/login?/private/, which takes care of sending you to /private/
once you've logged in.  Ugly, but it seems to work most of the time.
<<<

This is what I do... I  add a 'return url' to the Form's init...

def logon(request):
     if request.get_environ('HTTP_REFERER'):
         referer = request.get_environ('HTTP_REFERER')
     else:
         referer = "/"
     if referer.find('/logon') == -1:
         redirect_url = referer

     return DoLogin(redirect_url).handle(request)

and in DoLogin.__init__() I store redirect_url as a hidden form field, and
test it yet again in action(). Its a little clunky but works, the user
doesn't see the clunky-ness, and I don't have to remember to do anything to
the calling URL...

Mike



reply