Good answer from Gary -- cheers.

So it seems like it would be rare to want to use web.redirect,
> correct?


Yeah, I guess rarer than 303. We use it in our code for redirecting people
to the canonical URLs. For instance, if you visit www.micropledge.com,
you'll get a 301 (web.redirect) pointing you to micropledge.com. And if you
visit http://micropledge.com/projects/MoDWsGi you'll get a 301 pointing you
to http://micropledge.com/projects/modwsgi

You could just serve up the right page without the 301. But having canonical
URLs is A Good Thing, search engines like it, and you get nice consistent
URLs floating around the place.

Does this mean this authentication example is using it incorrectly?
> http://webpy.infogami.com/authentication
> Relevent code:
>         if inp.username == user.username and inp.password ==
> user.password:
>             dologin(user)
>             web.redirect('/')
>         else:
>             web.render('login.html')


Yeah, for redirect-after-POST I think it should be using web.seeother (HTTP
303) for that. From the
spec<http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4>:
"This method exists primarily to allow the output of a POST-activated script
to redirect the user agent to a selected resource."

Cheers,
Ben.

-- 
Ben Hoyt, +64 21 331 841
http://www.benhoyt.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to