Fw: Re: [mod_python] Publisher Handler and redirect

Michael Krasnovsky mk at lrn.ru
Thu Aug 15 13:10:18 EST 2002


Begin forwarded message:

Date: Thu, 15 Aug 2002 00:18:39 +0200
From: Mateusz Korniak <mateusz at ant.gliwice.pl>
To: mk at lrn.ru
Subject: Re: [mod_python] Publisher Handler and redirect


On Wednesday 14 August 2002 23:25, Michael Krasnovsky wrote:
> Hello!
>
> I have a problem. I need redirection inside a publisher handler. I try
> using req.headers_out["Location"] = "http://www.example.com", but it
> doesn't work.
> Here is the example:
>
> def test(req):
> 	"""
> 	"""
> 	req.headers_out["Location"] = "http://www.example.com"
> 	req.send_http_header()
> 	return "Going to Example.com..."
>
> What's wrong?
Missing req.status set to mod_python.apache.HTTP_*_REDIRECT
 
def redirect(req):
	req.status = mod_python.apache.HTTP_TEMPORARY_REDIRECT
	req.headers_out["Location"] = "http://www.ant.gliwice.pl"
	req.send_http_header()


P.S. This should go to FAQ ;)

-- 
Mateusz Korniak
"Black holes are where God divided by zero." - Steven Wright


-- 
Michael Krasnovsky

Partner
Project Leader

bisoft s.r.o., Prague, Czech Republic

T +420 [0]2  51 61 42 21
M +420 [0]724  13 33 80
E michael.krasnovsky at bisoft.cz



More information about the Mod_python mailing list