Thursday, February 14, 2008

Redirecting from mod_python

The sort of thing I'm inclined to forget:

def handler(req):
req.headers_out['location'] = ''
req.status = apache.HTTP_MOVED_TEMPORARILY
return apache.OK

Care of the mod_python FAQ.

1 comment:

Graham Dumpleton said...

You don't need 'req.send_http_header()' for mod_python 3.X, that was only required for mod_python 2.X.

You should also perhaps instead look at the mod_python.util.redirect() function instead. See '

Finally, one should be redirecting oneself to '' these days and not ''. ;-)