Just a fundamentals type question. When should I use web.redirect and
when should I use web.seeother?
What are the differences? How do they affect caching?
Thanks,
Greg
web.redirect is HTTP 301, which means "the thing you're looking for
has moved and is now permanently at this other location".
web.seeother is HTTP 303, which means "the result of your request is
at this other URL", which is a temporary kind of redirect. The major
practical difference is that the result of a 301 should be cached by
clients, but 303 shouldn't. You can find more complete information in
the standard [1]. Of course, as always, the various browsers may not
implement these status codes correctly.
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
--
Gary
http://blog.extracheese.org
So it seems like it would be rare to want to use web.redirect,
correct?
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')
(BTW side comment, I don't think that page made it over to the new
wiki)
-Greg
So it seems like it would be rare to want to use web.redirect,
correct?
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')
Thanks, Ben. Well then, I think this is the cause of the not
reloading after login problem you mentioned. Well, I"m hoping at
least. I'll try it out later. And getting rid of my inappropriate
redirects is the right thing to do anyway :-)
Group, FYI Ben is having an issue on my site (utilitymill.com) where
after he logs in, the home page doesn't change/update to reflect the
fact that he's logged in until he does a refresh. I'm suspecting it's
the redirect so far.
-Greg