|
Kory Hamzeh
kory at avatar.com
Fri Jul 29 18:00:13 EDT 2011
Hi Everyone,
I'm having trouble doing a redirect using the 'Location:' keyword in the
header. My code, near the top of the handler is:
Def index(req):
# determine is we need a redirect. Set must_redirect to True is so ....
if must_redirect:
req.headers_out["HTTP/1.1"] = "301 Moved Permanently"
req.headers_out["Location:"] = "http://www.example.com/"
req.content_type = 'text/html'
return ""
I get an empty page on he browser.
I've also tried:
Def index(req):
If must_redirect:
s = """
HTTP/1.1 301 Moved Permanently
Location: http://www.example.org/
Content-Type: text/html
"""
return s
I get a page with that exact text on it.
I'm using a publisher handler.
What am I doing wrong?
Thanks,
Kory
|